From 2637821cb7466330f5c612be809531cb65790219 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 04 七月 2025 20:01:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/components/jeecgbiz/JSelectRepairDepart.vue | 183 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 183 insertions(+), 0 deletions(-) diff --git a/src/components/jeecgbiz/JSelectRepairDepart.vue b/src/components/jeecgbiz/JSelectRepairDepart.vue new file mode 100644 index 0000000..c2442a1 --- /dev/null +++ b/src/components/jeecgbiz/JSelectRepairDepart.vue @@ -0,0 +1,183 @@ +<template> + <div class="components-input-demo-presuffix"> + <!----> + <a-input @click="openModal" placeholder="璇风偣鍑婚�夋嫨缁翠慨閮ㄩ棬" v-model="textVals" readOnly :disabled="disabled"> + <a-icon slot="prefix" type="cluster" title="缁翠慨閮ㄩ棬閫夋嫨鎺т欢"/> + <a-icon v-if="storeVals" slot="suffix" type="close-circle" @click="handleEmpty" title="娓呯┖"/> + </a-input> + <j-select-repair-depart-modal + ref="innerRepairDepartSelectModal" + :modal-width="modalWidth" + :multi="multi" + :rootOpened="rootOpened" + :repairDepartId="value" + :store="storeField" + :text="textField" + :treeRepairDepartOpera="treeRepairDepartOpera" + @ok="handleOK" + @initComp="initComp"> + + </j-select-repair-depart-modal> + </div> +</template> + +<script> + import JSelectRepairDepartModal from './modal/JSelectRepairDepartModal' + import { underLinetoHump } from '@/components/_util/StringUtil' + export default { + name: 'JSelectRepairDepart', + components:{ + JSelectRepairDepartModal + }, + props:{ + modalWidth:{ + type:Number, + default:500, + required:false + }, + multi:{ + type:Boolean, + default:false, + required:false + }, + rootOpened:{ + type:Boolean, + default:true, + required:false + }, + value:{ + type:String, + required:false + }, + disabled:{ + type: Boolean, + required: false, + default: false + }, + // 鑷畾涔夎繑鍥炲瓧娈碉紝榛樿杩斿洖 id + customReturnField: { + type: String, + default: '' + }, + backRepairDepart: { + type: Boolean, + default: false, + required: false + }, + // 瀛樺偍瀛楁 [key field] + store: { + type: String, + default: 'id', + required: false + }, + // 鏄剧ず瀛楁 [label field] + text: { + type: String, + default: 'departName', + required: false + }, + treeRepairDepartOpera: { + type: Boolean, + default: false, + required: false + } + + }, + data(){ + return { + visible:false, + confirmLoading:false, + storeVals: '', //[key values] + textVals: '' //[label values] + } + }, + computed:{ + storeField(){ + let field = this.customReturnField + if(!field){ + field = this.store; + } + return underLinetoHump(field) + }, + textField(){ + return underLinetoHump(this.text) + } + }, + mounted(){ + this.storeVals = this.value + }, + watch:{ + value(val){ + this.storeVals = val + } + }, + methods:{ + initComp(textVals){ + this.textVals = textVals + }, + //杩斿洖閫変腑鐨勮溅闂翠俊鎭� + backRepairDepartInfo(){ + if(this.backRepairDepart===true){ + //LOWCOD-2147 銆愮敤鎴风鐞嗐�戦�夋嫨閮ㄩ棬鍜屼笂绾т互鍚庯紝璐熻矗閮ㄩ棬娌℃湁鏁版嵁鍙�� (闄剁値鏀归�犺嚜瀹氫箟杩斿洖瀛楁瀵艰嚧) + if(this.storeVals && this.storeVals.length>0){ + let arr1 = this.storeVals.split(',') + let arr2 = this.textVals.split(',') + let info = [] + for(let i=0;i<arr1.length;i++){ + info.push({ + value: arr1[i], + text: arr2[i] + }) + } + this.$emit('back', info) + } + } + }, + openModal(){ + this.$refs.innerRepairDepartSelectModal.show() + }, + handleOK(rows) { + if (!rows && rows.length <= 0) { + this.textVals = '' + this.storeVals = '' + } else { + let arr1 = [] + let arr2 = [] + for(let dep of rows){ + arr1.push(dep[this.storeField]) + arr2.push(dep[this.textField]) + } + this.storeVals = arr1.join(',') + this.textVals = arr2.join(',') + } + this.$emit("change", this.storeVals) + this.backRepairDepartInfo() + }, + getRepairDepartNames(){ + return this.departNames + }, + handleEmpty(){ + this.handleOK('') + } + }, + model: { + prop: 'value', + event: 'change' + } + } +</script> + +<style scoped> + .components-input-demo-presuffix .anticon-close-circle { + cursor: pointer; + color: #ccc; + transition: color 0.3s; + font-size: 12px; + } + .components-input-demo-presuffix .anticon-close-circle:hover { + color: #f5222d; + } + .components-input-demo-presuffix .anticon-close-circle:active { + color: #666; + } +</style> \ No newline at end of file -- Gitblit v1.9.3