From ff5d803034d471b6d6acd63cd775cad80b4b69ac Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期六, 09 九月 2023 14:16:41 +0800
Subject: [PATCH] 人员组织结构申请接口开发
---
Source/UBCS-WEB/src/components/work/BusinessWork.vue | 172 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 145 insertions(+), 27 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/work/BusinessWork.vue b/Source/UBCS-WEB/src/components/work/BusinessWork.vue
index 3597bfa..24a6a7e 100644
--- a/Source/UBCS-WEB/src/components/work/BusinessWork.vue
+++ b/Source/UBCS-WEB/src/components/work/BusinessWork.vue
@@ -1,6 +1,6 @@
<template>
<div>
- <el-button @click="HandlerRend" size="small" type="primary">淇濆瓨</el-button>
+ <el-button @click="HandlerSave" v-if="hasEditor" size="small" type="primary" style="margin-bottom: 10px">淇濆瓨</el-button>
<el-table
v-loading="isLoading"
:data="tableData"
@@ -8,7 +8,6 @@
style=""
@cell-click="handleCellClick"
>
- <el-table-column fixed type="selection" width="55"> </el-table-column>
<el-table-column fixed label="搴忓彿" type="index" width="55">
</el-table-column>
<el-table-column
@@ -18,21 +17,43 @@
:prop="item.prop"
:sortable="item.sortable"
:formatter="item.formatter"
- :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'"
+ :width="item.width"
:show-overflow-tooltip="true"
align="center"
>
- <!-- 缂栬緫鍜屽睍绀洪�昏緫 -->
- <!-- <template slot-scope="{ row }">-->
- <!-- <el-input v-if="editingRow === row && editShow== item.prop" v-model="row[item.prop]" @blur="saveRow"></el-input>-->
- <!-- <span v-else>{{row[item.prop]}}</span>-->
- <!-- <el-switch-->
- <!-- v-if="editShow === 'true'"-->
- <!-- v-model="row[item.prop]"-->
- <!-- active-color="#13ce66"-->
- <!-- inactive-color="#ff4949">-->
- <!-- </el-switch>-->
- <!-- </template>-->
+ <template slot-scope="{ row }">
+ <el-input
+ v-if="editingRow === row && editShow== item.prop && item.edit == 'input'" v-model="row[item.prop]"
+ @blur="editingRows=null"></el-input>
+ <el-input-number size="small" controls-position="right"
+ v-if="editingRow === row && editShow== item.prop && item.edit == 'number'" v-model="row[item.prop]"
+ @blur="editingRows=null" :style="{width:(item.width-10)+'px'}"></el-input-number>
+ <el-select filterable default-first-option slot="prepend" @change="changeSelect"
+ v-if="editingRow === row && editShow== item.prop && item.edit == 'select' " v-model="row[item.prop]" @blur="editingRows=null">
+ <el-option
+ v-for="optionItem in item.dicData"
+ :key="optionItem.key"
+ :label="optionItem.value"
+ :value="optionItem.key">
+ </el-option>
+ </el-select>
+ <el-switch
+ v-if="editingRow === row && editShow== item.prop && (item.edit === 'switch' || item.edit === 'truefalse')" v-model="row[item.prop]" active-value="true"
+ inactive-value="false">
+ </el-switch>
+ <el-date-picker
+ v-if="editingRow === row && editShow== item.prop && (item.edit == 'date' || item.edit == 'datetime') " v-model="row[item.prop]" @blur="editingRows=null"
+ :type="item.edit" :format="item.dateFormate" :value-format="item.dateFormate"
+ placeholder="閫夋嫨鏃ユ湡">
+ </el-date-picker>
+ <vciWebRefer v-if="editingRow === row && editShow== item.prop && item.edit == 'refer'"
+ :referConfig="item.referConfig || {}"
+ :value="row[item.referConfig.field] || row[item.prop]"
+ :text="row[item.referConfig.showField]" :disabled="item.disabled" :display="item.display"
+ @setReferValue="setReferValue"
+ ></vciWebRefer>
+ <span v-else v-html="formatter(row,item)"></span>
+ </template>
</el-table-column>
</el-table>
</div>
@@ -40,11 +61,15 @@
<script>
import {businese} from '@/api/work/businese'
-import {FlowTable} from "@/api/GetItem";
+import {FlowTable, batchUpdateCode} from "@/api/GetItem";
import {validatenull} from "@/util/validate";
+import {getDictionary} from "@/api/system/dict";
+import vciWebRefer from "../refer/vciWebRefer.vue";
+
export default {
name: "BusinessWork",
- props:['ids','templateId',"taskId","modelKey","codeClassifyOid"],
+ components: { vciWebRefer },
+ props:['ids','templateId',"taskId","modelKey","codeClassifyOid",'stageAttrs'],
data() {
return {
BuinessOids:[],
@@ -53,41 +78,81 @@
tableData:[],
editingRow: null,
editShow: "",
- editAttr: ""
+ editAttr: "",
+ hasEditor:false,
+ columnType: {
+ text: "input",
+ combox: "select",
+ truefalse: "switch",
+ number: "number",
+ textarea: "textarea",
+ datetime: "datetime",
+ date: "date",
+ refer: "refer"
+ }
}
},
watch:{
ids:{
handler(newval,oldval){
this.BuinessOids=newval;
+ this.CrudHeaderRend()
this.BuinseseRend()
- console.log(newval)
- console.log(this.BuinessOids)
},
deep:true
+ },
+ stageAttrs(newval,oldval){
+ this.hasEditor=newval.length>0;
}
},
created() {
+
},
mounted() {
},
methods:{
- HandlerRend(){
- this.editingRow = null;
+ HandlerSave(){
+ if(!validatenull(this.editingRow)) {
+ this.editingRow = null;
+ //淇濆瓨
+ let datas = this.tableData.map(item => {
+ let newitem = {
+ codeClassifyOid: item.codeclsfid,
+ templateOid: this.templateId,
+ editInProcess: true,
+ data: item,
+ oid: item.oid,
+ ts: item.ts
+ }
+ return newitem;
+ })
+ batchUpdateCode(datas).then(res => {
+ if (res.data.success) {
+ this.$message.success("淇敼鎴愬姛");
+ this.BuinseseRend()
+ }
+ })
+ }
},
//琛ㄦ牸澶存覆鏌�
CrudHeaderRend() {
if (this.codeClassifyOid != "") {
+ var data=new FormData()
+ data.append('templateId', this.templateId)
+ data.append('taskId', this.taskId)
+ data.append('modelKey', this.modelKey)
+ data.append('codeClassifyOid', this.codeClassifyOid)
FlowTable({
- templateId: this.templateId,
- taskId : this.taskId ,
- modelKey: this.modelKey,
- codeClassifyOid: this.codeClassifyOid
+ 'templateId': this.templateId,
+ 'taskId': this.taskId,
+ 'modelKey': this.modelKey,
+ 'codeClassifyOid': this.codeClassifyOid
}).then((res) => {
this.options = res.data.tableDefineVO.seniorQueryColumns;
this.List = res.data.tableDefineVO.cols[0];
this.tableHeadData=[];
this.List.forEach((item) => {
+ let editAttr=this.stageAttrs.filter(stageitem => stageitem.attrId == item.field || (item.fieldType=='combox' && stageitem.attrId+'Text' == item.field)|| (item.fieldType=='refer' && stageitem.attrId+'name' == item.field));
let columnItem = {
label: item.title,
prop: item.field,
@@ -106,8 +171,33 @@
return row[column.property] == 'true' || row[column.property] == '1' ? '鏄�' : '鍚�'
}
}
+
}
- this.tableHeadData.push(columnItem)
+ if(editAttr.length>0) {
+ columnItem.edit= this.columnType[item.fieldType]
+ if (columnItem.edit == 'select') {
+ //闇�瑕佽幏鍙栦笅鎷夋鏁版嵁
+ columnItem.dicData = item.data || this.geDictData(item.comboxKey)
+ columnItem.formatter = function (row, column) {
+ let d=column.dicData.find((value, keys, arr) => {
+ return value.key == row[column.prop.replace('Text','')];
+ })
+ return row[column.prop] =(d && d.value) || row[column.prop]
+ }
+ }
+ if (columnItem.edit == 'refer') {
+ columnItem.referConfig = {
+ title: item.title,
+ showField: item.showField || item.field,
+ field: item.sortField || item.field,
+ options: item.referConfig
+ }
+ columnItem.display=!item.hidden;
+ columnItem.disabled=item.readOnly
+ }
+ }
+
+ this.tableHeadData.push(Object.assign(item, columnItem))
});
});
}
@@ -121,11 +211,39 @@
this.tableData = res.data.data;
})
},
+ // 寮傛鑾峰彇瀛楀吀鏁版嵁
+ geDictData(dictKey) {
+ getDictionary({code: dictKey}).then((res) => {
+ if (res.data && res.data.code === 200) {
+ return (res.data.data || []).map((itm) => {
+ itm.value = itm.dictValue;
+ itm.key = itm.dictKey;
+ return itm;
+ });
+ }
+ });
+ },
// 鐩戝惉鍗曞厓鏍肩偣鍑讳簨浠跺苟瀛樺偍姝e湪缂栬緫鐨勮
- handleCellClick(row, column) {
+ handleCellClick(row, column, cell, event) {
this.editingRow = row;
this.editShow = column.property;
},
+ formatter(row, column){
+ if(column.formatter){
+ return column.formatter(row,column)
+ }else{
+ return row[column.prop]
+ }
+ },
+ setReferValue(data) {
+ if (data.field) {
+ this.editingRow[data.field] = data.value || "";
+ this.editingRow[data.showField] = data.text || "";
+ }
+ },
+ changeSelect(data){
+ this.editingRow[this.editShow.replace('Text','')] = data;
+ }
}
}
</script>
--
Gitblit v1.9.3