Browse Source

plm BM

master
ruanqi 2 years ago
parent
commit
a9f0afd911
  1. 23
      src/assets/scss/rq.scss
  2. 65
      src/main.js
  3. 63
      src/utils/highlight.js
  4. 15
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_customerInformation.vue
  5. 7
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_demoSlot.vue
  6. 4
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_inkMixing.vue
  7. 4
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_lamination.vue
  8. 4
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_prepress.vue
  9. 15
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_routing.vue
  10. 45
      src/views/modules/sampleManagement/technicalSpecificationDetail/com_tsd_basicInformation.vue
  11. 102
      src/views/modules/sys/dict-data-select-highlight.vue

23
src/assets/scss/rq.scss

@ -77,19 +77,17 @@
font-weight: bold;
color: rgb(24, 182, 166);
}
/* 定义高亮样式 */
.highlight .el-input__inner {
border-color: #08c2bc;
background-color: #96ea93;
}
.highlight .el-textarea__inner {
border-color: #08c2bc;
background-color: #96ea93;
}
///* 定义高亮样式 */
.highlightSelect {
//.highlight .el-input__inner {
// border-color: #08c2bc;
// background-color: #96ea93;
//}
/////* 定义高亮样式 */
//.highlight .el-textarea__inner {
// border-color: #08c2bc;
// background-color: #96ea93;
//}
.highlight {
border-color: #08c2bc;
background-color: #96ea93;
}
@ -97,3 +95,4 @@

65
src/main.js

@ -23,7 +23,7 @@ import { debounce,throttle} from '@/utils/common.js'
import selectDiv from '@/views/common/selectDiv.vue'
import {resetForm} from "./utils/system";
import echarts from "echarts";
import highlightContainer from './utils/highlight';
Vue.prototype.$echarts = echarts;
Vue.component('downloadExcel', JsonExcel)
@ -31,7 +31,7 @@ Vue.component('pdf', pdf)
Vue.use(VueCookie)
Vue.config.productionTip = false
Vue.component('selectDiv', selectDiv);
Vue.directive('highlight-container', highlightContainer);
// 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock
if (process.env.NODE_ENV !== 'production') {
require('@/mock')
@ -57,7 +57,15 @@ new Vue({
i18n,
store,
template: '<App/>',
components: { App }
components: { App },
mounted() {
Vue.nextTick(() => {
// 在这里调用自定义指令的绑定逻辑
this.$el.querySelectorAll('[v-highlight-container]').forEach(el => {
highlightContainer.bind.call({ el, bind: {} }, el);
});
});
}
})
// 在Vue实例初始化之前添加全局事件监听器 type为number的输入库禁用上下箭头
@ -72,42 +80,25 @@ document.addEventListener('keydown', function(event) {
}
});
Vue.directive('highlight-on-change', {
bind(el) {
// 保存初始值
el.dataset.originalValue = el.value;
// 监听 input 事件
el.addEventListener('input', function() {
const isModified = el.value !== el.dataset.originalValue;
if (isModified) {
el.classList.add('highlight');
} else {
el.classList.remove('highlight');
}
});
}
});
Vue.directive('highlight-on-changeSelect', {
bind(el, binding, vnode) {
const selectComponent = vnode.componentInstance;
// 保存初始值
el.dataset.originalValue = selectComponent.value;
Vue.prototype.$clearHighLight = function () {
// 监听 change 事件
selectComponent.$on('change', function(value) {
const isModified = value !== el.dataset.originalValue;
const inputEl = el.querySelector('.el-input__inner');
if (inputEl) {
if (isModified) {
inputEl.classList.add('highlightSelect');
} else {
inputEl.classList.remove('highlightSelect');
}
}
});
}
// 查找所有带有 highlight 类的元素
const highlightedElements = this.$el.querySelectorAll('.highlight');
});
// 移除 highlight 类
highlightedElements.forEach(el => {
el.classList.remove('highlight');
});
};
Vue.prototype.$triggerInputEvent = function (inputRef) {
const inputElement = inputRef.$el.querySelector('.el-input__inner');
if (inputElement) {
inputElement.dispatchEvent(new Event('input'));
}
};

63
src/utils/highlight.js

@ -0,0 +1,63 @@
export default {
bind(el) {
// 获取所有子元素中的 input 和 el-select
const inputs = el.querySelectorAll('input');
const selects = el.querySelectorAll('.el-select');
const textareas = el.querySelectorAll('textarea');
// 处理所有的 input 元素
inputs.forEach(inputEl => {
inputEl.dataset.originalValue = inputEl.value;
inputEl.addEventListener('input', function() {
const isModified = inputEl.value !== inputEl.dataset.originalValue;
if (isModified) {
inputEl.classList.add('highlight');
} else {
inputEl.classList.remove('highlight');
}
});
});
// 处理所有的 textarea 元素
textareas.forEach(textareaEl => {
textareaEl.dataset.originalValue = textareaEl.value;
// 监听 input 事件
textareaEl.addEventListener('input', function() {
const isModified = textareaEl.value !== textareaEl.dataset.originalValue;
if (isModified) {
textareaEl.classList.add('highlight');
} else {
textareaEl.classList.remove('highlight');
}
});
});
// 处理所有的 el-select 元素
selects.forEach(selectEl => {
const selectComponent = selectEl.__vue__;
if (!selectComponent) {
console.warn('Element does not have a Vue instance attached.');
return;
}
selectEl.dataset.originalValue = selectComponent.value;
selectComponent.$on('change', function(value) {
const selectInputEl = selectEl.querySelector('.el-input__inner');
if (selectInputEl) {
const isModified = value !== selectEl.dataset.originalValue;
if (isModified) {
selectInputEl.classList.add('highlight');
} else {
selectInputEl.classList.remove('highlight');
}
}
});
});
}
};

15
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_customerInformation.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
<el-button type="primary" @click="refresh()" >刷新数据</el-button>
<el-button type="primary" @click="saveData()" v-if="!ifDisableFlag">保存</el-button>
@ -60,7 +60,7 @@
</div></el-col>
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item :label="'材料或成品/Material Or Label'">
<el-select v-highlight-on-changeSelect v-model="dataForm.materialType" :disabled="ifDisableFlag">
<el-select v-model="dataForm.materialType" :disabled="ifDisableFlag">
<el-option label="Label" value="Label"></el-option>
<el-option label="Material" value="Material"></el-option>
</el-select>
@ -105,14 +105,14 @@
<el-row :gutter="20" style="margin-top: 60px">
<el-col :span="24"><div class="grid-content bg-purple">
<el-form-item :label="'附加客户图纸/Attach Customer Drawing'">
<el-input v-highlight-on-change v-model="dataForm.pictureAddess" :disabled="ifDisableFlag" ></el-input>
<el-input v-model="dataForm.pictureAddess" :disabled="ifDisableFlag" ></el-input>
</el-form-item>
</div></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24"><div class="grid-content bg-purple">
<el-form-item :label="'客户图纸变更说明/Attach Customer Drawing'">
<el-input v-highlight-on-change
<el-input
type="textarea"
v-model="dataForm.customerPictureChangeRemark "
:rows="3"
@ -127,7 +127,7 @@
<el-row :gutter="20" style="margin-top: 60px">
<el-col :span="24"><div class="grid-content bg-purple">
<el-form-item :label="'转量产附档说明/MP Comments'">
<el-input v-highlight-on-change
<el-input
type="textarea"
v-model="dataForm.productionFileComments "
:rows="3"
@ -143,7 +143,7 @@
<el-row :gutter="20" style="margin-top: 60px">
<el-col :span="24"><div class="grid-content bg-purple">
<el-form-item :label="'备注/Comments'">
<el-input v-highlight-on-change
<el-input
type="textarea"
v-model="dataForm.remark"
:rows="3"
@ -277,6 +277,7 @@
})
return false
}
this.$clearHighLight()
tsdBasicInformationSearch(this.searchData).then(({data}) => {
this.baseForm=data.row;
this.getNodeAuthority(data.row)
@ -308,6 +309,7 @@
this.dataForm.codeNo=this.searchData.codeNo
}
});
},
saveData(){
this.$confirm("是否保存信息?", '保存提示', {
@ -317,6 +319,7 @@
updateBMcustomerInfo(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.$clearHighLight()
} else {
this.$message.error(data.msg)
}

7
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_demoSlot.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 1px; margin-left: 0px;" >
<!-- <el-form-item :label="'技术参数卡编码'">-->
<!-- <el-input v-model="searchData.oriCodeNo" readonly style="width: 150px" ></el-input>-->
@ -53,6 +53,7 @@
min-width="400"
label="值">
<template slot-scope="scope">
<div v-highlight-container>
<el-input v-if="scope.row.valueTypeDb === 'T'&&scope.row.valueChooseFlag === 'N'" v-model="scope.row.textValue" style="height: 11px;padding: 0px ;width:98%" allow-create :disabled="ifDisableFlag" ></el-input>
<div v-if="scope.row.valueTypeDb === 'S'&&scope.row.valueChooseFlag === 'N'"><el-input v-model="scope.row.textValue" style="height: 11px;padding: 0px ;width:98%" allow-create :disabled="ifDisableFlag"></el-input></div>
<el-input v-if="scope.row.valueTypeDb === 'N'&&scope.row.valueChooseFlag === 'N'" v-model="scope.row.numValue" type="number" style="height: 11px;padding: 0px;width:98%" allow-create :disabled="ifDisableFlag"></el-input>
@ -80,7 +81,7 @@
:value="item.availableValue">
</el-option>
</el-select></div>
</div>
</template>
</el-table-column>
</el-table>
@ -166,6 +167,7 @@
this.baseForm=data.row;
this.getNodeAuthority(data.row)
})
this.$clearHighLight()
},
refreshBMPageModal(){
this.$confirm(`是否刷新至最新模板界面,已填数据会更新到新模板中,若旧属性在新模板中被删除,该条数据会消失。`, '提示', {
@ -195,6 +197,7 @@
saveTable(){
saveBMPropertiesValue(this.tableData).then(({data}) => {
if (data && data.code === 0) {
this.$clearHighLight()
this.$message({
message: '操作成功',
type: 'success',

4
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_inkMixing.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" >
<el-row :gutter="20">
<el-col :span="6"><div class="grid-content bg-purple">
@ -303,6 +303,7 @@
}).then(() => {
updateBMInkMixingDetail(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$clearHighLight()
this.$message.success( '操作成功')
} else {
this.$message.error(data.msg)
@ -349,6 +350,7 @@
colorSearch(){
searchBMInkMixingColor(this.searchData).then(({data}) => {
this.$clearHighLight()
this.colorTable = data.rows
});
},

4
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_lamination.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" >
<el-form-item >
<el-button type="primary" @click="cutSearch()" >刷新</el-button>
@ -335,6 +335,7 @@
cancelButtonText: '取消',
}).then(() => {
updateBMLaminationDetail(this.dataForm).then(({data}) => {
this.$clearHighLight()
if (data && data.code === 0) {
this.$message.success( '操作成功')
} else {
@ -383,6 +384,7 @@
cutSearch(){
searchBMLaminationCut(this.searchData).then(({data}) => {
this.$clearHighLight()
this.cutTable = data.rows
});
},

4
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_prepress.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" v-if="searchData.buNo==='Flexo'">
<el-row :gutter="20">
<el-col :span="6"><div class="grid-content bg-purple">
@ -318,6 +318,7 @@
}).then(() => {
updateBMPrepressDetail(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$clearHighLight()
this.$message.success( '操作成功')
this.$emit("closeModel")
} else {
@ -364,6 +365,7 @@
colorSearch(){
searchBMPrepressColor(this.searchData).then(({data}) => {
this.$clearHighLight()
this.colorTable = data.rows
});
},

15
src/views/modules/sampleManagement/technicalSpecificationDetail/com_bm_routing.vue

@ -1,16 +1,16 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;" >
<el-form-item label="Process">
<dict-data-select :site="searchData.site" v-if="searchData.site" v-model="sheetData.process" dict-type="bm_process" style="width: 120px"></dict-data-select>
</el-form-item>
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,1)"><a herf="#">热转移打印人员</a></span>
<el-input v-model="sheetData.overPrintOperatorName" placeholder="请选择人员" readonly style="width: 120px" ></el-input>
<el-input v-model="sheetData.overPrintOperatorName" ref="overPrintOperatorName" placeholder="请选择人员" readonly style="width: 120px" ></el-input>
</el-form-item>
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,2)"><a herf="#">印刷人员</a></span>
<el-input v-model="sheetData.printOperatorName" placeholder="请选择人员" readonly style="width: 120px" ></el-input>
<el-input v-model="sheetData.printOperatorName" ref="printOperatorName" placeholder="请选择人员" readonly style="width: 120px" ></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="updateBMProcess()" v-if="!ifDisableFlag">保存</el-button>
@ -469,7 +469,7 @@
import cqc from "./com_bm_demoSlot";/*组件*/
import printFlexo from "./com_bm_printingFlexo";/*组件*/
import printIndigo from "./com_bm_printingIndigo";
import DictDataSelect from "../../sys/dict-data-select";
import DictDataSelect from "../../sys/dict-data-select-highlight";
/*组件*/
export default {
components: {
@ -900,10 +900,16 @@
if(this.tagNo1==1) {
this.sheetData.overPrintOperator = val.username
this.sheetData.overPrintOperatorName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.overPrintOperatorName);
});
}
if(this.tagNo1==2) {
this.sheetData.printOperator = val.username
this.sheetData.printOperatorName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.printOperatorName);
});
}
}
},
@ -1352,6 +1358,7 @@
updateBMProcess(){
updateBMProcess(this.sheetData).then(({data}) => {
if (data && data.code === 0) {
this.$clearHighLight()
tsdBasicInformationSearch(this.searchData).then(({data}) => {
if(data.row){
this.sheetData=data.row

45
src/views/modules/sampleManagement/technicalSpecificationDetail/com_tsd_basicInformation.vue

@ -1,5 +1,5 @@
<template>
<div class="mod-config">
<div class="mod-config" v-highlight-container>
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
<el-button type="primary" @click="refresh()" >刷新数据</el-button>
<el-button type="primary" @click="saveData()" v-if="!ifDisableFlag">保存</el-button>
@ -102,13 +102,13 @@
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,1)"><a herf="#">CQC人员</a></span>
<el-input v-model="dataForm.cqcOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.cqcOperatorName" ref="cqcOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,2)"><a herf="#">FAI人员</a></span>
<el-input v-model="dataForm.faiOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.faiOperatorName" ref="faiOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
</el-row>
@ -117,13 +117,13 @@
<el-col :span="12"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="engineerChooseModal()"><a herf="#">Select PE Engineer</a></span>
<el-input v-model="dataForm.engineer" readonly style="" @focus="engineerChooseModal()"></el-input>
<el-input v-model="dataForm.engineer" ref="engineer" readonly style="" @focus="engineerChooseModal()"></el-input>
</el-form-item>
</div></el-col>
<el-col :span="12"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="technicianModal()"><a herf="#">Select Artwork</a></span>
<el-input v-model="dataForm.technician" readonly style="" @focus="technicianModal()"></el-input>
<el-input v-model="dataForm.technician" ref="technician" readonly style="" @focus="technicianModal()"></el-input>
</el-form-item>
</div></el-col>
</el-row>
@ -132,25 +132,25 @@
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,3)"><a herf="#">PE人员</a></span>
<el-input v-model="dataForm.peOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.peOperaterName" ref="peOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,4)"><a herf="#">CS人员</a></span>
<el-input v-model="dataForm.csOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.csOperaterName" ref="csOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,5)"><a herf="#">DCC人员</a></span>
<el-input v-model="dataForm.dccOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.dccOperaterName" ref="dccOperaterName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
<el-col :span="6"><div class="grid-content bg-purple">
<el-form-item >
<span slot="label" style="" @click="getBaseList(103,6)"><a herf="#">MP人员</a></span>
<el-input v-model="dataForm.mpOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
<el-input v-model="dataForm.mpOperatorName" ref="mpOperatorName" placeholder="请选择人员" readonly style="" ></el-input>
</el-form-item>
</div></el-col>
</el-row>
@ -167,7 +167,7 @@
<el-row :gutter="20">
<el-col :span="24"><div class="grid-content bg-purple">
<el-form-item label="备注区" style="height: 200px">
<el-form-item label="备注区" style="height: 200px">
<el-input
type="textarea"
v-model="dataForm.remarkPage "
@ -368,26 +368,44 @@
if(this.tagNo1==1) {
this.dataForm.cqcOperator = val.username
this.dataForm.cqcOperatorName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.cqcOperatorName);
});
}
if(this.tagNo1==2) {
this.dataForm.faiOperator = val.username
this.dataForm.faiOperatorName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.faiOperatorName);
});
}
if(this.tagNo1==3) {
this.dataForm.peOperater = val.username
this.dataForm.peOperaterName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.peOperaterName);
});
}
if(this.tagNo1==4) {
this.dataForm.csOperater = val.username
this.dataForm.csOperaterName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.csOperaterName);
});
}
if(this.tagNo1==5) {
this.dataForm.dccOperater = val.username
this.dataForm.dccOperaterName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.dccOperaterName);
});
}
if(this.tagNo1==6) {
this.dataForm.mpOperator = val.username
this.dataForm.mpOperatorName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.mpOperatorName);
});
}
}
},
@ -411,14 +429,12 @@
})
return false
}
this.$clearHighLight()
tsdBasicInformationSearch(this.searchData).then(({data}) => {
//
if (data && data.code == 0) {
this.getNodeAuthority(data.row)
this.dataForm = data.row
console.log(!this.ifDisableFlag)
console.log(this.dataForm.status === 'spz')
console.log(this.dataForm.status === 'spz'&&!this.ifDisableFlag)
this.$alert('刷新成功', '成功', {
confirmButtonText: '确定'
})
@ -531,6 +547,7 @@
}
this.dataForm.quotationOfficer=quotationOfficerName
this.dataForm.quotationOfficerList=JSON.parse(JSON.stringify(this.quotationOfficerList));
// this.$triggerInputEvent(this.$refs.quotationOfficer);
this.quotationOfficerFlag=false
},
@ -558,6 +575,7 @@
}
this.dataForm.engineer=engineerName
this.dataForm.engineerList=JSON.parse(JSON.stringify(this.engineerList));
this.$triggerInputEvent(this.$refs.engineer);
this.engineerFlag=false
},
technicianModal(){
@ -593,6 +611,7 @@
updateBMBasicInformation(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.$clearHighLight()
} else {
this.$message.error(data.msg)
}

102
src/views/modules/sys/dict-data-select-highlight.vue

@ -0,0 +1,102 @@
<template>
<div v-highlight-container>
<el-select v-bind="$attrs" v-on="$listeners" :value="value" style="width: 100%" @change="changeDictData">
<el-option v-for="(item, index) in options"
:key="index" :label="item.dictLabel"
:value="item.dictValue"
:disabled="item.status === 'N' || disabledOptionsValue.includes(item.dictValue)">
<slot :label="item.dictLabel" :value="item.dictValue"></slot>
</el-option>
</el-select>
</div>
</template>
<script>
import {selectDictDataList} from "../../../api/dict";
export default {
name:'dictDataSelect',
model:{
prop:'value',
event:'change'
},
props:{
dictType: {
type: String,
},
dictTypeList:{
type:Array,
default:()=>[],
},
value:{
required: true,
},
useDefaultValue:{
type:Boolean,
default:true,
},
useSite:{
type:Boolean,
default:true,
},
disabledOptionsValue:{
type:Array,
default:()=>[],
},
site:{
type:String,
default:undefined,
}
},
data () {
return {
options: []
}
},
created () {
this.initOption()
},
methods: {
dictDefaultValue(){
// value ,value
if (!this.value && this.options.length > 0){
let find = this.options.find(item=>item.isDefault === 'Y');
if (find && find.status === 'Y'){
this.$emit("change",find.dictValue);
}
}
},
//options
async initOption () {
//
let params = {
site:this.useSite?this.$store.state.user.site:"*",
dictType:this.dictType,
dictTypeList: this.dictTypeList
}
if (this.site){
params.site = this.site
}
try {
//
let {data} = await selectDictDataList(params);
//
if (data && data.code === 0){
this.options = data.rows;
if (this.options.length === 0){
this.$emit("change",'')
}
}
if (this.useDefaultValue){
this.dictDefaultValue();
}
}catch (e) {
return Promise.reject(e)
}
},
// el-select @change,
changeDictData(val){
this.$emit('change',val)
}
}
}
</script>
Loading…
Cancel
Save