Merge branch 'master' of http://222.71.165.188:3000/yunxi/jigangSCM2
commit
99e2829f01
@ -0,0 +1,129 @@
|
|||||||
|
package jnpf.database.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import jnpf.base.UserInfo;
|
||||||
|
import jnpf.constant.PermissionConst;
|
||||||
|
import jnpf.permission.entity.OrganizeEntity;
|
||||||
|
import jnpf.permission.entity.UserEntity;
|
||||||
|
import jnpf.permission.service.OrganizeService;
|
||||||
|
import jnpf.util.DateUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import jnpf.util.UserProvider;
|
||||||
|
import jnpf.util.context.SpringContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MybatisPlus配置类
|
||||||
|
*
|
||||||
|
* @author Allen Pan
|
||||||
|
* @version V3.4.1
|
||||||
|
* @copyright 长江云息
|
||||||
|
* @date 2019年9月27日 上午9:18
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
//@Configuration
|
||||||
|
//@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
|
||||||
|
public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
//@Autowired
|
||||||
|
private static ApplicationContext applicationContext;
|
||||||
|
private UserProvider userProvider;
|
||||||
|
|
||||||
|
private OrganizeService organizeService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
String companyId = "";
|
||||||
|
// userProvider= applicationContext.getBean(UserProvider.class);
|
||||||
|
UserProvider userProvider = SpringContext.getBean(UserProvider.class);
|
||||||
|
OrganizeService organizeService = SpringContext.getBean(OrganizeService.class);
|
||||||
|
UserInfo userInfo= userProvider.get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(userInfo != null && StringUtil.isNotEmpty(userInfo.getOrganizeId())){
|
||||||
|
OrganizeEntity organizeEntity = organizeService.getInfo(userInfo.getOrganizeId());
|
||||||
|
companyId = organizeService.getOrganizeIdTree(organizeEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(userInfo != null && StringUtil.isNotEmpty(userInfo.getOrganizeId())){
|
||||||
|
OrganizeEntity organizeEntity = organizeService.getInfo(userInfo.getOrganizeId());
|
||||||
|
if(PermissionConst.DEPARTMENT.equals(organizeEntity.getCategory())){
|
||||||
|
userInfo.setDepartmentId(organizeEntity.getId());
|
||||||
|
do {
|
||||||
|
//获取父组织
|
||||||
|
organizeEntity = organizeService.getInfo(organizeEntity.getParentId());
|
||||||
|
}while (PermissionConst.DEPARTMENT.equals(organizeEntity.getCategory()));
|
||||||
|
companyId = organizeEntity.getId();
|
||||||
|
}else{
|
||||||
|
companyId = organizeEntity.getId();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// 可以在这里填充编码查询到编码规则自动填充
|
||||||
|
// TableInfo tableInfo = this.findTableInfo(metaObject);
|
||||||
|
// String tableName = tableInfo.getTableName();
|
||||||
|
log.info("start insert fill ....");
|
||||||
|
System.out.println(userInfo);
|
||||||
|
this.setFieldValByName("creatorUserId", userInfo.getUserId(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("creatorTime", DateUtil.getNowDate(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("creatorUserName", userInfo.getUserName(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("creatoruserid", userInfo.getUserId(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("creatortime", DateUtil.getNowDate(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("creatorusername", userInfo.getUserName(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyUserId", userInfo.getUserId(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyTime", DateUtil.getNowDate(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyUserName", userInfo.getUserName(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("orgnizeId", userInfo.getOrganizeId(), metaObject);
|
||||||
|
this.setFieldValByName("companyId", companyId, metaObject);
|
||||||
|
this.setFieldValByName("departmentId", userInfo.getDepartmentId(), metaObject);
|
||||||
|
// System.out.println(userProvider.getDepartmentId(userInfo.getUserId()));
|
||||||
|
/*if (userInfo.getUserId()!=null){
|
||||||
|
this.setFieldValByName("departmentId", userProvider.getDepartmentId(userInfo.getUserId()), metaObject);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
log.info("start update fill ....");
|
||||||
|
UserProvider userProvider = SpringContext.getBean(UserProvider.class);
|
||||||
|
System.out.println(userProvider.get());
|
||||||
|
// userProvider= applicationContext.getBean(UserProvider.class);
|
||||||
|
UserInfo userInfo = userProvider.get();
|
||||||
|
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyTime", DateUtil.getNowDate(), metaObject);
|
||||||
|
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyUserId", userInfo.getUserId(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("lastModifyUserName", userInfo.getUserName(), metaObject);
|
||||||
|
|
||||||
|
|
||||||
|
this.setFieldValByName("deleteTime", DateUtil.getNowDate(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("deleteUserId", userInfo.getUserId(), metaObject);
|
||||||
|
|
||||||
|
this.setFieldValByName("deleteUserName", userInfo.getUserName(), metaObject);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="详情"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('creditRating')"
|
||||||
|
|
||||||
|
>
|
||||||
|
<jnpf-form-tip-item label="信用级别"
|
||||||
|
prop="creditRating" >
|
||||||
|
<p>{{ dataForm.creditRating }} </p>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('scoreDown')"
|
||||||
|
|
||||||
|
>
|
||||||
|
<jnpf-form-tip-item label="评定分数最低"
|
||||||
|
prop="scoreDown" >
|
||||||
|
<p>{{dataForm.scoreDown}}</p>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('scoreUpper')"
|
||||||
|
|
||||||
|
>
|
||||||
|
<jnpf-form-tip-item label="评定分数最高"
|
||||||
|
prop="scoreUpper" >
|
||||||
|
<p>{{dataForm.scoreUpper}}</p>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
</span>
|
||||||
|
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
import { getConfigData } from '@/api/onlineDev/visualDev'
|
||||||
|
import jnpf from '@/utils/jnpf'
|
||||||
|
import Detail from '@/views/basic/dynamicModel/list/detail'
|
||||||
|
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||||
|
export default {
|
||||||
|
components: { Detail},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
detailVisible: false,
|
||||||
|
loading: false,
|
||||||
|
|
||||||
|
dataForm: {
|
||||||
|
id :'',
|
||||||
|
creditRating : "",
|
||||||
|
scoreDown : '',
|
||||||
|
scoreUpper : '',
|
||||||
|
},
|
||||||
|
creditRatingOptions:[{"fullName":"一星","id":"1"},{"fullName":"二星","id":"2"},{"fullName":"三星","id":"3"}],
|
||||||
|
creditRatingProps:{"label":"fullName","value":"id" },
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
toDetail(defaultValue, modelId) {
|
||||||
|
if (!defaultValue) return
|
||||||
|
getConfigData(modelId).then(res => {
|
||||||
|
if (!res.data || !res.data.formData) return
|
||||||
|
let formData = JSON.parse(res.data.formData)
|
||||||
|
formData.popupType = 'general'
|
||||||
|
this.detailVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.Detail.init(formData, modelId, defaultValue)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
},
|
||||||
|
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/scm/SubjectCreditRating/detail/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,2 @@
|
|||||||
|
const columnList = [{"filterable":false,"clearable":true,"jnpfKey":"select","multiple":false,"fullName":"信用级别","label":"信用级别","sortable":false,"align":"left","props":{"label":"fullName","value":"id"},"__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"select","defaultValue":"","noShow":false,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"信用级别","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592206543,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-select","propsName":"","tag":"JnpfSelect","regList":[],"span":24},"prop":"creditRating","width":0,"options":[{"fullName":"一星","id":"1"},{"fullName":"二星","id":"2"},{"fullName":"三星","id":"3"}],"__vModel__":"creditRating","fixed":"none","style":{"width":"100%"},"disabled":false,"interfaceHasPage":false,"id":"creditRating","placeholder":"请选择","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"jnpfKey":"input","suffixIcon":"","fullName":"评定分数最低","label":"评定分数最低","sortable":false,"align":"left","addonAfter":"","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"评定分数最低","trigger":"blur","showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592177015,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"prop":"scoreDown","showWordLimit":false,"width":0,"__vModel__":"scoreDown","showPassword":false,"fixed":"none","style":{"width":"100%"},"disabled":false,"id":"scoreDown","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"jnpfKey":"input","suffixIcon":"","fullName":"评定分数最高","label":"评定分数最高","sortable":false,"align":"left","addonAfter":"","__config__":{"formId":104,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"评定分数最高","trigger":"blur","showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592246774,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"prop":"scoreUpper","showWordLimit":false,"width":0,"__vModel__":"scoreUpper","showPassword":false,"fixed":"none","style":{"width":"100%"},"disabled":false,"id":"scoreUpper","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}]
|
||||||
|
export default columnList
|
@ -0,0 +1,411 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-dialog :title="!dataForm.id ? '新建' :'编辑'"
|
||||||
|
:close-on-click-modal="false" append-to-body
|
||||||
|
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||||
|
width="600px">
|
||||||
|
<el-row :gutter="15" class="">
|
||||||
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" >
|
||||||
|
<template v-if="!loading">
|
||||||
|
<!-- 具体表单 -->
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('creditRating')" >
|
||||||
|
<jnpf-form-tip-item
|
||||||
|
label="信用级别" v-if="jnpf.hasFormP('creditRating')" prop="creditRating" >
|
||||||
|
<JnpfSelect v-model="dataForm.creditRating" @change="changeData('creditRating',-1)"
|
||||||
|
placeholder="请选择" clearable :style='{"width":"100%"}' :options="creditRatingOptions" :props="creditRatingProps" >
|
||||||
|
</JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('scoreDown')" >
|
||||||
|
<jnpf-form-tip-item
|
||||||
|
label="评定分数最低" v-if="jnpf.hasFormP('scoreDown')" prop="scoreDown" >
|
||||||
|
<JnpfInput v-model="dataForm.scoreDown" @change="changeData('scoreDown',-1)"
|
||||||
|
placeholder="请输入" clearable :style='{"width":"100%"}'>
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-if="jnpf.hasFormP('scoreUpper')" >
|
||||||
|
<jnpf-form-tip-item
|
||||||
|
label="评定分数最高" v-if="jnpf.hasFormP('scoreUpper')" prop="scoreUpper" >
|
||||||
|
<JnpfInput v-model="dataForm.scoreUpper" @change="changeData('scoreUpper',-1)"
|
||||||
|
placeholder="请输入" clearable :style='{"width":"100%"}'>
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- 表单结束 -->
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
|
||||||
|
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<div class="upAndDown-button" v-if="dataForm.id">
|
||||||
|
<el-button @click="prev" :disabled='prevDis'>
|
||||||
|
{{'上一条'}}
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="next" :disabled='nextDis'>
|
||||||
|
{{'下一条'}}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
|
||||||
|
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button>
|
||||||
|
<el-button @click="visible = false"> 取 消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> 确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||||
|
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||||
|
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
|
||||||
|
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
|
||||||
|
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
|
||||||
|
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||||
|
export default {
|
||||||
|
components: { },
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataFormSubmitType: 0,
|
||||||
|
continueBtnLoading: false,
|
||||||
|
index: 0,
|
||||||
|
prevDis: false,
|
||||||
|
nextDis: false,
|
||||||
|
allList: [],
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
btnLoading: false,
|
||||||
|
formRef: 'formRef',
|
||||||
|
setting:{},
|
||||||
|
eventType: '',
|
||||||
|
userBoxVisible:false,
|
||||||
|
selectDialogVisible: false,
|
||||||
|
currTableConf:{},
|
||||||
|
dataValueAll:{},
|
||||||
|
addTableConf:{
|
||||||
|
},
|
||||||
|
//可选范围默认值
|
||||||
|
ableAll:{
|
||||||
|
},
|
||||||
|
tableRows:{
|
||||||
|
},
|
||||||
|
Vmodel:"",
|
||||||
|
currVmodel:"",
|
||||||
|
dataForm: {
|
||||||
|
creditRating : undefined,
|
||||||
|
scoreDown : undefined,
|
||||||
|
scoreUpper : undefined,
|
||||||
|
},
|
||||||
|
tableRequiredData: {},
|
||||||
|
dataRule:
|
||||||
|
{
|
||||||
|
},
|
||||||
|
creditRatingOptions:[{"fullName":"一星","id":"1"},{"fullName":"二星","id":"2"},{"fullName":"三星","id":"3"}],
|
||||||
|
creditRatingProps:{"label":"fullName","value":"id" },
|
||||||
|
childIndex:-1,
|
||||||
|
isEdit:false,
|
||||||
|
interfaceRes: {
|
||||||
|
creditRating:[] ,
|
||||||
|
scoreDown:[] ,
|
||||||
|
scoreUpper:[] ,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['userInfo'])
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.dataAll()
|
||||||
|
this.initDefaultData()
|
||||||
|
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
prev() {
|
||||||
|
this.index--
|
||||||
|
if (this.index === 0) {
|
||||||
|
this.prevDis = true
|
||||||
|
}
|
||||||
|
this.nextDis = false
|
||||||
|
for (let index = 0; index < this.allList.length; index++) {
|
||||||
|
const element = this.allList[index];
|
||||||
|
if (this.index == index) {
|
||||||
|
this.getInfo(element.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
next() {
|
||||||
|
this.index++
|
||||||
|
if (this.index === this.allList.length - 1) {
|
||||||
|
this.nextDis = true
|
||||||
|
}
|
||||||
|
this.prevDis = false
|
||||||
|
for (let index = 0; index < this.allList.length; index++) {
|
||||||
|
const element = this.allList[index];
|
||||||
|
if (this.index == index) {
|
||||||
|
this.getInfo(element.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getInfo(id) {
|
||||||
|
request({
|
||||||
|
url: '/api/scm/SubjectCreditRating/'+ id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refreshDataList', true)
|
||||||
|
},
|
||||||
|
changeData(model, index) {
|
||||||
|
this.isEdit = false
|
||||||
|
this.childIndex = index
|
||||||
|
let modelAll = model.split("-");
|
||||||
|
let faceMode = "";
|
||||||
|
for (let i = 0; i < modelAll.length; i++) {
|
||||||
|
faceMode += modelAll[i];
|
||||||
|
}
|
||||||
|
for (let key in this.interfaceRes) {
|
||||||
|
if (key != faceMode) {
|
||||||
|
let faceReList = this.interfaceRes[key]
|
||||||
|
for (let i = 0; i < faceReList.length; i++) {
|
||||||
|
if (faceReList[i].relationField == model) {
|
||||||
|
let options = 'get' + key + 'Options';
|
||||||
|
if(this[options]){
|
||||||
|
this[options]()
|
||||||
|
}
|
||||||
|
this.changeData(key, index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeDataFormData(type, data, model,index,defaultValue) {
|
||||||
|
if(!this.isEdit) {
|
||||||
|
if (type == 2) {
|
||||||
|
for (let i = 0; i < this.dataForm[data].length; i++) {
|
||||||
|
if (index == -1) {
|
||||||
|
this.dataForm[data][i][model] = defaultValue
|
||||||
|
} else if (index == i) {
|
||||||
|
this.dataForm[data][i][model] = defaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.dataForm[data] = defaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataAll(){
|
||||||
|
},
|
||||||
|
clearData(){
|
||||||
|
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
|
||||||
|
},
|
||||||
|
init(id,isDetail,allList) {
|
||||||
|
this.prevDis = false
|
||||||
|
this.nextDis = false
|
||||||
|
this.allList = allList || []
|
||||||
|
if (allList.length) {
|
||||||
|
this.index = this.allList.findIndex(item => item.id === id)
|
||||||
|
if (this.index == 0) {
|
||||||
|
this.prevDis = true
|
||||||
|
}
|
||||||
|
if (this.index == this.allList.length - 1) {
|
||||||
|
this.nextDis = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.prevDis = true
|
||||||
|
this.nextDis = true
|
||||||
|
}
|
||||||
|
this.dataForm.id = id || 0;
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if(this.dataForm.id){
|
||||||
|
this.loading = true
|
||||||
|
request({
|
||||||
|
url: '/api/scm/SubjectCreditRating/'+this.dataForm.id,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataInfo(res.data)
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.clearData()
|
||||||
|
this.initDefaultData()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||||
|
},
|
||||||
|
//初始化默认数据
|
||||||
|
initDefaultData() {
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit(type) {
|
||||||
|
this.dataFormSubmitType = type ? type : 0
|
||||||
|
this.$refs['formRef'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.request()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
request() {
|
||||||
|
let _data =this.dataList()
|
||||||
|
if (this.dataFormSubmitType == 2) {
|
||||||
|
this.continueBtnLoading = true
|
||||||
|
} else {
|
||||||
|
this.btnLoading = true
|
||||||
|
}
|
||||||
|
if (!this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: '/api/scm/SubjectCreditRating',
|
||||||
|
method: 'post',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
if (this.dataFormSubmitType == 2) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.clearData()
|
||||||
|
this.initDefaultData()
|
||||||
|
})
|
||||||
|
this.continueBtnLoading = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.visible = false
|
||||||
|
this.btnLoading = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(()=>{
|
||||||
|
this.btnLoading = false
|
||||||
|
this.continueBtnLoading = false
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
request({
|
||||||
|
url: '/api/scm/SubjectCreditRating/'+this.dataForm.id,
|
||||||
|
method: 'PUT',
|
||||||
|
data: _data
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
onClose: () => {
|
||||||
|
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
|
||||||
|
this.visible = false
|
||||||
|
this.btnLoading = false
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(()=>{
|
||||||
|
this.btnLoading = false
|
||||||
|
this.continueBtnLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openSelectDialog(key) {
|
||||||
|
this.currTableConf=this.addTableConf[key]
|
||||||
|
this.currVmodel=key
|
||||||
|
this.selectDialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.selectDialog.init()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addForSelect(data) {
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
let t = data[i]
|
||||||
|
if(this['get'+this.currVmodel]){
|
||||||
|
this['get'+this.currVmodel](t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
||||||
|
let timeDataValue = null;
|
||||||
|
let timeValue = Number(timeValueData)
|
||||||
|
if (timeRule) {
|
||||||
|
if (timeType == 1) {
|
||||||
|
timeDataValue = timeValue
|
||||||
|
} else if (timeType == 2) {
|
||||||
|
timeDataValue = dataValue
|
||||||
|
} else if (timeType == 3) {
|
||||||
|
timeDataValue = new Date().getTime()
|
||||||
|
} else if (timeType == 4) {
|
||||||
|
let previousDate = '';
|
||||||
|
if (timeTarget == 1 || timeTarget == 2) {
|
||||||
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||||
|
timeDataValue = new Date(previousDate).getTime()
|
||||||
|
} else if (timeTarget == 3) {
|
||||||
|
previousDate = getBeforeData(timeValue)
|
||||||
|
timeDataValue = new Date(previousDate).getTime()
|
||||||
|
} else {
|
||||||
|
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
||||||
|
}
|
||||||
|
} else if (timeType == 5) {
|
||||||
|
let previousDate = '';
|
||||||
|
if (timeTarget == 1 || timeTarget == 2) {
|
||||||
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||||
|
timeDataValue = new Date(previousDate).getTime()
|
||||||
|
} else if (timeTarget == 3) {
|
||||||
|
previousDate = getLaterData(timeValue)
|
||||||
|
timeDataValue = new Date(previousDate).getTime()
|
||||||
|
} else {
|
||||||
|
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timeDataValue;
|
||||||
|
},
|
||||||
|
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
||||||
|
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
||||||
|
let timeDataValue = null
|
||||||
|
if (timeRule) {
|
||||||
|
if (timeType == 1) {
|
||||||
|
timeDataValue = timeValue || '00:00:00'
|
||||||
|
if (timeDataValue.split(':').length == 3) {
|
||||||
|
timeDataValue = timeDataValue
|
||||||
|
} else {
|
||||||
|
timeDataValue = timeDataValue + ':00'
|
||||||
|
}
|
||||||
|
} else if (timeType == 2) {
|
||||||
|
timeDataValue = dataValue
|
||||||
|
} else if (timeType == 3) {
|
||||||
|
timeDataValue = this.jnpf.toDate(new Date(), format)
|
||||||
|
} else if (timeType == 4) {
|
||||||
|
let previousDate = '';
|
||||||
|
previousDate = getBeforeTime(timeTarget, timeValue)
|
||||||
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||||
|
} else if (timeType == 5) {
|
||||||
|
let previousDate = '';
|
||||||
|
previousDate = getLaterTime(timeTarget, timeValue)
|
||||||
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timeDataValue;
|
||||||
|
},
|
||||||
|
dataList(){
|
||||||
|
var _data = this.dataForm;
|
||||||
|
return _data;
|
||||||
|
},
|
||||||
|
dataInfo(dataAll){
|
||||||
|
let _dataAll =dataAll
|
||||||
|
this.dataForm = _dataAll
|
||||||
|
this.isEdit = true
|
||||||
|
this.dataAll()
|
||||||
|
this.childIndex=-1
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,2 @@
|
|||||||
|
const superQueryJson = [{"filterable":false,"clearable":true,"multiple":false,"fullName":"信用级别","props":{"label":"fullName","value":"id"},"__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"select","defaultValue":"","noShow":false,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"信用级别","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592206543,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-select","propsName":"","tag":"JnpfSelect","regList":[],"span":24},"options":[{"fullName":"一星","id":"1"},{"fullName":"二星","id":"2"},{"fullName":"三星","id":"3"}],"__vModel__":"creditRating","style":{"width":"100%"},"disabled":false,"interfaceHasPage":false,"id":"creditRating","placeholder":"请选择","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"评定分数最低","addonAfter":"","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"评定分数最低","trigger":"blur","showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592177015,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"scoreDown","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"scoreDown","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"评定分数最高","addonAfter":"","__config__":{"formId":104,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"评定分数最高","trigger":"blur","showLabel":true,"required":false,"tableName":"jg_subject_credit_rating","renderKey":1706592246774,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"scoreUpper","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"scoreUpper","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}]
|
||||||
|
export default superQueryJson
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,452 @@
|
|||||||
|
<template>
|
||||||
|
<span class="popupSelect-container">
|
||||||
|
<span @click.stop="openDialog" style="cursor: pointer; color: blue;">关联机构</span>
|
||||||
|
<!-- <div class="el-select" @click.stop="openDialog">
|
||||||
|
<div class="el-select__tags" v-if="multiple" ref="tags"
|
||||||
|
:style="{ 'max-width': inputWidth - 32 + 'px', width: '100%',cursor:'pointer' }">
|
||||||
|
<span v-if="collapseTags && tagsList.length">
|
||||||
|
<el-tag :closable="!selectDisabled" :size="collapseTagSize" type="info"
|
||||||
|
@close="deleteTag($event, 0)" disable-transitions>
|
||||||
|
<span class="el-select__tags-text">{{ tagsList[0] }}</span>
|
||||||
|
</el-tag>
|
||||||
|
<el-tag v-if="tagsList.length > 1" :closable="false" type="info" disable-transitions>
|
||||||
|
<span class="el-select__tags-text">+ {{ tagsList.length - 1 }}</span>
|
||||||
|
</el-tag>
|
||||||
|
</span>
|
||||||
|
<transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
|
||||||
|
<el-tag v-for="(item,i) in tagsList" :key="item" :size="collapseTagSize"
|
||||||
|
:closable="!selectDisabled" type="info" @close="deleteTag($event, i)"
|
||||||
|
disable-transitions>
|
||||||
|
<span class="el-select__tags-text">{{ item }}</span>
|
||||||
|
</el-tag>
|
||||||
|
</transition-group>
|
||||||
|
</div>
|
||||||
|
<el-input ref="reference" v-model="innerValue" type="text" :placeholder="currentPlaceholder"
|
||||||
|
:disabled="selectDisabled" readonly :validate-event="false"
|
||||||
|
:tabindex="(multiple) ? '-1' : null" @mouseenter.native="inputHovering = true"
|
||||||
|
@mouseleave.native="inputHovering = false">
|
||||||
|
<template slot="suffix">
|
||||||
|
<i v-show="!showClose"
|
||||||
|
:class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up']"></i>
|
||||||
|
<i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close"
|
||||||
|
@click="handleClearClick"></i>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</div> -->
|
||||||
|
<el-dialog title="选择组织" :close-on-click-modal="false" :visible.sync="visible"
|
||||||
|
class="JNPF-dialog JNPF-dialog_center transfer-dialog" lock-scroll append-to-body
|
||||||
|
width="800px" :modal-append-to-body="false" @close="onClose">
|
||||||
|
<div class="transfer__body">
|
||||||
|
<div class="transfer-pane">
|
||||||
|
<div class="transfer-pane__tools">
|
||||||
|
<el-input placeholder="请输入关键词查询" v-model="keyword" @keyup.enter.native="search"
|
||||||
|
clearable class="search-input">
|
||||||
|
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
<div class="transfer-pane__body">
|
||||||
|
<el-tree :data="treeData" :props="props" check-on-click-node
|
||||||
|
:expand-on-click-node="false" default-expand-all @node-click="handleNodeClick"
|
||||||
|
class="JNPF-common-el-tree" node-key="id" v-loading="loading" ref="tree"
|
||||||
|
:filter-node-method="filterNode">
|
||||||
|
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
|
||||||
|
<i :class="data.icon"></i>
|
||||||
|
<span class="text">{{node.label}}</span>
|
||||||
|
</span>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="transfer-pane">
|
||||||
|
<div class="transfer-pane__tools">
|
||||||
|
<span>已选</span>
|
||||||
|
<el-button @click="removeAll" type="text" class="removeAllBtn">清空列表</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="transfer-pane__body shadow right-pane">
|
||||||
|
<template>
|
||||||
|
<div v-for="(item, index) in selectedData" :key="index" class="selected-item">
|
||||||
|
<span :title="item">{{item}}</span>
|
||||||
|
<i class="el-icon-delete" @click="removeData(index)"></i>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="setDefault(),visible=false">{{$t('common.cancelButton')}}</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">{{$t('common.confirmButton')}}</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
|
||||||
|
import { getDepartmentSelectorByAuth } from "@/api/permission/department";
|
||||||
|
import { getOrganizeSelectorByAuth, getOrgByOrganizeCondition } from '@/api/permission/organize'
|
||||||
|
import emitter from 'element-ui/src/mixins/emitter'
|
||||||
|
let { methods: { dispatch } } = emitter
|
||||||
|
export default {
|
||||||
|
name: 'JnpfOrganizeSelect',
|
||||||
|
inject: {
|
||||||
|
elForm: {
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
elFormItem: {
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '请选择'
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
collapseTags: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
clearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
auth: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isOnlyOrg: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
size: String,
|
||||||
|
currOrgId: {
|
||||||
|
default: '0'
|
||||||
|
},
|
||||||
|
parentId: {
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
selectType: {
|
||||||
|
type: String,
|
||||||
|
default: 'all'
|
||||||
|
},
|
||||||
|
ableIds: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
businessLineId: {
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
treeData: [],
|
||||||
|
allList: [],
|
||||||
|
keyword: '',
|
||||||
|
innerValue: '',
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
props: {
|
||||||
|
children: 'children',
|
||||||
|
label: 'fullName',
|
||||||
|
isLeaf: 'isLeaf'
|
||||||
|
},
|
||||||
|
selectedData: [],
|
||||||
|
selectedIds: [],
|
||||||
|
tagsList: [],
|
||||||
|
inputHovering: false,
|
||||||
|
inputWidth: 0,
|
||||||
|
initialInputHeight: 0,
|
||||||
|
businessLineId: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
showClose() {
|
||||||
|
let hasValue = Array.isArray(this.value) && this.value.length > 0
|
||||||
|
let criteria = this.clearable &&
|
||||||
|
!this.selectDisabled &&
|
||||||
|
this.inputHovering &&
|
||||||
|
hasValue;
|
||||||
|
return criteria;
|
||||||
|
},
|
||||||
|
currentPlaceholder() {
|
||||||
|
if (this.multiple && Array.isArray(this.value) && this.value.length) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
|
return this.placeholder
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectDisabled() {
|
||||||
|
return this.disabled || (this.elForm || {}).disabled;
|
||||||
|
},
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
selectSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
|
},
|
||||||
|
collapseTagSize() {
|
||||||
|
return ['small', 'mini'].indexOf(this.selectSize) > -1
|
||||||
|
? 'mini'
|
||||||
|
: 'small';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getData()
|
||||||
|
this.businessLineId = businessLineId
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
addResizeListener(this.$el, this.handleResize);
|
||||||
|
|
||||||
|
const reference = this.$refs.reference;
|
||||||
|
if (reference && reference.$el) {
|
||||||
|
const sizeMap = {
|
||||||
|
medium: 36,
|
||||||
|
small: 32,
|
||||||
|
mini: 28
|
||||||
|
};
|
||||||
|
const input = reference.$el.querySelector('input');
|
||||||
|
this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
|
||||||
|
}
|
||||||
|
if (this.multiple) {
|
||||||
|
this.resetInputHeight();
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (reference && reference.$el) {
|
||||||
|
this.inputWidth = reference.$el.getBoundingClientRect().width;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setDefault()
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
this.setDefault()
|
||||||
|
},
|
||||||
|
selectDisabled() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetInputHeight();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
allList: {
|
||||||
|
handler: function (val) {
|
||||||
|
this.setDefault()
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getData() {
|
||||||
|
const treeData = await this.$store.dispatch('generator/getDepTree')
|
||||||
|
const topItem = {
|
||||||
|
fullName: "顶级节点",
|
||||||
|
hasChildren: true,
|
||||||
|
id: "-1",
|
||||||
|
icon: "icon-ym icon-ym-tree-organization3",
|
||||||
|
organize: '顶级节点',
|
||||||
|
organizeIds: ['-1']
|
||||||
|
}
|
||||||
|
this.allList = [...this.$store.getters.departmentList, topItem]
|
||||||
|
if (this.selectType === 'all') {
|
||||||
|
if (this.auth) {
|
||||||
|
if (this.isOnlyOrg && this.parentId === '-1') {
|
||||||
|
this.treeData = [topItem]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const method = this.isOnlyOrg ? getOrganizeSelectorByAuth : getDepartmentSelectorByAuth
|
||||||
|
method(this.currOrgId).then(res => {
|
||||||
|
this.treeData = res.data.list
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.treeData = treeData
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.ableIds.length) {
|
||||||
|
this.treeData = [];
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const departIds = this.ableIds ? this.ableIds.map(o => o[o.length - 1]) : [];
|
||||||
|
const query = { departIds };
|
||||||
|
getOrgByOrganizeCondition(query).then(res => {
|
||||||
|
this.treeData = res.data.list;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClose() { },
|
||||||
|
clear() {
|
||||||
|
if (this.selectDisabled) return
|
||||||
|
this.innerValue = ''
|
||||||
|
this.selectedData = []
|
||||||
|
this.selectedIds = []
|
||||||
|
this.tagsList = []
|
||||||
|
this.$emit('input', [])
|
||||||
|
this.$emit('change', [], [])
|
||||||
|
dispatch.call(this, 'ElFormItem', 'el.form.change', [])
|
||||||
|
},
|
||||||
|
openDialog() {
|
||||||
|
if (this.selectDisabled) return
|
||||||
|
this.keyword = ''
|
||||||
|
this.treeData = []
|
||||||
|
this.getData()
|
||||||
|
this.setDefault()
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.$refs.tree && this.$refs.tree.filter(this.keyword)
|
||||||
|
},
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true;
|
||||||
|
return data[this.props.label].indexOf(value) !== -1;
|
||||||
|
},
|
||||||
|
getNodePath(node) {
|
||||||
|
let fullPath = []
|
||||||
|
const loop = (node) => {
|
||||||
|
if (node.level) fullPath.unshift(node.data)
|
||||||
|
if (node.parent) loop(node.parent)
|
||||||
|
}
|
||||||
|
loop(node)
|
||||||
|
return fullPath
|
||||||
|
},
|
||||||
|
handleNodeClick(data) {
|
||||||
|
if (data.disabled) return
|
||||||
|
let currId = data.organizeIds
|
||||||
|
let currData = data.organize
|
||||||
|
if (this.multiple) {
|
||||||
|
const boo = this.selectedIds.some(o => o.join('/') === currId.join('/'))
|
||||||
|
if (boo) return
|
||||||
|
this.selectedIds.push(currId)
|
||||||
|
this.selectedData.push(currData)
|
||||||
|
} else {
|
||||||
|
this.selectedIds = [currId]
|
||||||
|
this.selectedData = [currData]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeAll() {
|
||||||
|
this.selectedData = []
|
||||||
|
this.selectedIds = []
|
||||||
|
},
|
||||||
|
removeData(index) {
|
||||||
|
this.selectedData.splice(index, 1)
|
||||||
|
this.selectedIds.splice(index, 1)
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
let selectedData = []
|
||||||
|
for (let i = 0; i < this.selectedIds.length; i++) {
|
||||||
|
let item = []
|
||||||
|
let selectedNames = this.selectedData[i].split('/')
|
||||||
|
for (let j = 0; j < this.selectedIds[i].length; j++) {
|
||||||
|
item.push({
|
||||||
|
id: this.selectedIds[i][j],
|
||||||
|
fullName: selectedNames[j],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
selectedData.push(item)
|
||||||
|
}
|
||||||
|
if (this.multiple) {
|
||||||
|
this.innerValue = ''
|
||||||
|
this.tagsList = JSON.parse(JSON.stringify(this.selectedData))
|
||||||
|
this.$emit('input', this.selectedIds)
|
||||||
|
this.$emit('change', this.selectedIds, selectedData, this.businessLineId)
|
||||||
|
dispatch.call(this, 'ElFormItem', 'el.form.change', this.selectedIds)
|
||||||
|
} else {
|
||||||
|
this.innerValue = this.selectedData.join(',')
|
||||||
|
this.$emit('input', this.selectedIds[0] || [])
|
||||||
|
this.$emit('change', this.selectedIds[0] || [], selectedData[0] || [], this.businessLineId)
|
||||||
|
dispatch.call(this, 'ElFormItem', 'el.form.change', this.selectedIds[0] || [])
|
||||||
|
}
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
setDefault() {
|
||||||
|
if (!this.value || !this.value.length) {
|
||||||
|
this.innerValue = ''
|
||||||
|
this.selectedIds = []
|
||||||
|
this.selectedData = []
|
||||||
|
this.tagsList = []
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetInputHeight();
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let selectedIds = this.multiple ? this.value : [this.value]
|
||||||
|
this.selectedIds = JSON.parse(JSON.stringify(selectedIds))
|
||||||
|
let textList = []
|
||||||
|
for (let i = 0; i < selectedIds.length; i++) {
|
||||||
|
const item = selectedIds[i];
|
||||||
|
let textItem = JSON.parse(JSON.stringify(item))
|
||||||
|
for (let j = 0; j < item.length; j++) {
|
||||||
|
inner: for (let ii = 0; ii < this.allList.length; ii++) {
|
||||||
|
if (item[j] === this.allList[ii].id) {
|
||||||
|
textItem[j] = this.allList[ii].fullName
|
||||||
|
break inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textList.push(textItem)
|
||||||
|
}
|
||||||
|
this.selectedData = textList.map(o => o.join('/'))
|
||||||
|
if (this.multiple) {
|
||||||
|
this.innerValue = ''
|
||||||
|
this.tagsList = JSON.parse(JSON.stringify(this.selectedData))
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetInputHeight();
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.innerValue = this.selectedData.join(',')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteTag(event, index) {
|
||||||
|
this.selectedData.splice(index, 1)
|
||||||
|
this.selectedIds.splice(index, 1)
|
||||||
|
this.confirm()
|
||||||
|
event.stopPropagation();
|
||||||
|
},
|
||||||
|
handleClearClick(event) {
|
||||||
|
this.selectedData = []
|
||||||
|
this.selectedIds = []
|
||||||
|
this.confirm()
|
||||||
|
event.stopPropagation();
|
||||||
|
},
|
||||||
|
resetInputWidth() {
|
||||||
|
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
||||||
|
},
|
||||||
|
handleResize() {
|
||||||
|
this.resetInputWidth();
|
||||||
|
if (this.multiple) this.resetInputHeight();
|
||||||
|
},
|
||||||
|
resetInputHeight() {
|
||||||
|
if (this.collapseTags) return;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (!this.$refs.reference) return;
|
||||||
|
let inputChildNodes = this.$refs.reference.$el.childNodes;
|
||||||
|
let input = [].filter.call(inputChildNodes, item => item.tagName === 'INPUT')[0];
|
||||||
|
const tags = this.$refs.tags;
|
||||||
|
const tagsHeight = tags ? Math.round(tags.getBoundingClientRect().height) : 0;
|
||||||
|
const sizeInMap = this.initialInputHeight || 40;
|
||||||
|
input.style.height = this.selectedData.length === 0
|
||||||
|
? sizeInMap + 'px'
|
||||||
|
: Math.max(
|
||||||
|
tags ? (tagsHeight + (tagsHeight > sizeInMap ? 6 : 0)) : 0,
|
||||||
|
sizeInMap
|
||||||
|
) + 'px';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resetInputWidth() {
|
||||||
|
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
||||||
|
},
|
||||||
|
handleResize() {
|
||||||
|
this.resetInputWidth();
|
||||||
|
if (this.multiple) this.resetInputHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in new issue