From d896d25a2bee6dc9496f102035b2d68d17f3de65 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期二, 05 三月 2024 13:58:13 +0800 Subject: [PATCH] 生产调度变更记录功能 --- src/views/plan/productionschedul/index.vue | 785 ++++++++++++++++++++----------------------------------- 1 files changed, 293 insertions(+), 492 deletions(-) diff --git a/src/views/plan/productionschedul/index.vue b/src/views/plan/productionschedul/index.vue index fb8f678..20ddc6d 100644 --- a/src/views/plan/productionschedul/index.vue +++ b/src/views/plan/productionschedul/index.vue @@ -1,87 +1,33 @@ <template> <div class="mod-config"> <basic-container> - <el-row> - <el-col :span="24"> - <el-row style="padding:0px 10px;"> - <el-col :span="24" style="margin: 0;"> - <div style="display:flex;height:36px;justify-content: space-between;align-items:center;"> - <div> - <el-dropdown @command="changeTable"> - <span :style="dropdownTitleStyle" class="el-dropdown-link"> - {{dropdownTitle}}<i class="el-icon-arrow-down el-icon--right"></i> - </span> - <el-dropdown-menu slot="dropdown"> - <el-dropdown-item command="undone">寰呭畬鎴愯皟搴�</el-dropdown-item> - <el-dropdown-item command="done">宸插畬鎴愯皟搴�</el-dropdown-item> - </el-dropdown-menu> - </el-dropdown> - </div> - <div> - <el-button @click="tagFinished" v-if="showUnDownTable" size="mini" round type="success">鏍囪宸插畬鎴�</el-button> - <el-button size="mini" round type="primary" - v-if="permissions.plan_productionschedul_edit_line && showUnDownTable" - @click="openEditDialog">缂栬緫鏃堕棿绾�</el-button> - <el-tooltip content="鍒锋柊"> - <el-button circle icon="el-icon-refresh" @click="getDataList"></el-button> - </el-tooltip> - </div> - </div> - <!-- 寰呭畬鎴愯皟搴﹁〃鏍� --> - <avue-crud - v-if="showUnDownTable" - class="unfinished-crud" - :data="tableData" - ref="unfinished" - :option="option" - :span-method="spanMethod" - @refresh-change="getDataList" - @current-change="handleCurrentChange" - @size-change="handleSizeChange" - @cell-click="handleClickCell" - :page="page" - @selection-change="selectionRow" - :table-loading="loading"> - <template slot="product" slot-scope="scope"> - <el-link type="primary">{{ scope.row.product }}</el-link> - </template> - <template #menu="{ row, index }"> - <el-button - v-if="permissions.plan_productionschedul_edit" - type="text" - icon="el-icon-edit" - size="small" - @click="editHandle(row, index)">缂栬緫</el-button> - <el-button - v-if="permissions.plan_productionschedul_del" - type="text" - icon="el-icon-delete" - size="small" - @click="deleteHandle(row, index)">鍒犻櫎</el-button> - </template> - </avue-crud> - <!-- 宸插畬鎴愯皟搴﹁〃鏍� --> - <avue-crud - v-else - class="finished-crud" - :data="finishedTableData" - ref="finished" - :option="finishedOption" - :span-method="spanMethod" - @refresh-change="getFinishedData" - @current-change="handleCurrentChange" - @cell-click="handleClickCell" - @size-change="handleSizeChange" - :page="finishedPage" - @selection-change="selectionFinishedRow"> - <template slot="product" slot-scope="scope"> - <el-link type="primary">{{ scope.row.product }}</el-link> - </template> - </avue-crud> - </el-col> - </el-row> - </el-col> - </el-row> + <ttable + :rowKey="'mid'" + :table="table" + :prelang="prelang" + :options="options" + @handleSelectionChange="selectionRow" + :ajaxFun="ajaxFun" + :paramObj="queryParams" + :mergeSpanArr="spanArr" + :selColValArr="paramSelArr" + :selCol="paramSelCol" + ref="ttable"> + <template #toolbar> + <el-dropdown @command="changeTable"> + <span :style="dropdownTitleStyle" class="el-dropdown-link"> + {{dropdownTitle}}<i class="el-icon-arrow-down el-icon--right"></i> + </span> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="undone">寰呭畬鎴愯皟搴�</el-dropdown-item> + <el-dropdown-item command="done">宸插畬鎴愯皟搴�</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + <el-button v-if="showUnDownTable" @click="tagFinished" type="success">鏍囪宸插畬鎴�</el-button> + <el-button v-if="permissions.plan_productionschedul_edit_line && showUnDownTable" + @click="openEditDialog" type="primary">缂栬緫鏃堕棿绾�</el-button> + </template> + </ttable> </basic-container> <!-- 缂栬緫鏃堕棿绾� --> <el-dialog @@ -172,7 +118,7 @@ <el-timeline-item placement="top" :color="(item.actualTime) ? '#34BD66' :null" - :icon="(item.actualTime) ? 'el-icon-circle-check' :null" + :icon="(item.planTime || item.actualTime) ? 'el-icon-circle-check' :null" v-for="(item, index) in scheduleList" :key="index" :timestamp="item.title"> @@ -190,12 +136,27 @@ </div> </el-card> </el-dialog> + <!-- 鏌ョ湅鍙樻洿璁板綍 --> + <el-dialog + title="鍙樻洿璁板綍" + :visible.sync="showRecordsDialog" + width="60%"> + <el-table border :data="recordsList"> + <el-table-column type="index" width="50" label="搴忓彿" align="center"/> + <el-table-column prop="createTime" min-width="120" show-overflow-tooltip label="鎿嶄綔鏃堕棿" align="center"/> + <el-table-column prop="createUser" min-width="120" show-overflow-tooltip label="鎿嶄綔浜�" align="center"/> + <el-table-column prop="recordType" min-width="120" show-overflow-tooltip label="鎿嶄綔绫诲瀷" align="center"/> + <el-table-column prop="oldRecord" min-width="200" show-overflow-tooltip label="鏃у��" align="center"/> + <el-table-column prop="newRecord" min-width="200" show-overflow-tooltip label="鏂板��" align="center"/> + </el-table> + </el-dialog> </div> </template> <script> import { fetchScheduleList, + fetchRecordsList, fetchScheduleById, fillTime, deleteSchedul, @@ -208,6 +169,193 @@ export default { data() { return { + queryParams: { + state: false + }, + showRecordsDialog: false, + recordsList: [], + paramSelArr: [false], + paramSelCol: 'hasEdit', + ajaxFun: fetchScheduleList, + prelang: 'productSchedul', + options: { + height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾 + stripe: true, // 鏄惁涓烘枒椹汗 table + highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈 + border: true, // 鏄惁鏈夌旱鍚戣竟妗� + lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇 + fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮� + multiSelect: true, // + seqNo: true, + isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳 + isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳H + isSearch: true, // 楂樼骇鏌ヨ鎸夐挳 + defaultOrderBy: { column: 'time', direction: 'desc' }, + cancelRunCreated: false, + tableCellMerge: true + }, + table: { + total: 0, + currentPage: 1, + pageSize: 20, + data: [], + // 鏍囬 + column: [ + { + minWidth: 120, + prop: 'projectName', + label: '椤圭洰鍚嶇О', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 100, + prop: 'contractNo', + label: '鍚堝悓鍙�', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 120, + prop: 'orderTime', + label: '鎺ュ崟鏃ユ湡', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'date', + format: (row,columnValue)=> this.formatDate(row,columnValue) + }, + { + minWidth: 120, + prop: 'customerName', + label: '瀹㈡埛鍚嶇О', + isTrue: true, + searchInfoType: 'text', + isSearch: true, + }, + { + minWidth: 120, + prop: 'deliveryDate', + label: '浜よ揣鏃ユ湡', + isTrue: true, + sort: true, + isSearch: true, + searchInfoType: 'date', + format: (row,columnValue)=> this.formatDate(row,columnValue) + }, + { + minWidth: 120, + prop: 'productType', + label: '浜у搧绫诲瀷', + isTrue: true, + searchInfoType: 'text', + isSearch: true, + }, + { + minWidth: 120, + prop: 'product', + label: '浜у搧鍚�', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + render: { fun: this.handleClickCell } + }, + { + minWidth: 120, + prop: 'status', + label: '褰撳墠鐘舵��', + isTrue: true, + isSearch: true, + searchInfoType: 'select', + optList: ()=>{ + return [ + { label: '鏂囦欢绛惧彂', value: '鏂囦欢绛惧彂' }, + { label: '涓嬭揪鐗╂枡闇�姹�', value: '涓嬭揪鐗╂枡闇�姹�' }, + { label: '閲囪喘璇环+鍚堝悓绛捐', value: '閲囪喘璇环+鍚堝悓绛捐' }, + { label: '鐗╂枡閲囪喘鍒拌揣', value: '鐗╂枡閲囪喘鍒拌揣' }, + { label: '鐗╂枡鍒拌揣妫�楠�', value: '鐗╂枡鍒拌揣妫�楠�' }, + { label: '棰嗘枡銆佽绠卞叆搴�', value: '棰嗘枡銆佽绠卞叆搴�' }, + ] + } + }, + { + minWidth: 120, + prop: 'time', + label: '涓存湡鏃堕棿', + isTrue: true, + sort: true, + isSearch: true, + searchInfoType: 'date', + format: (row,columnValue)=> this.formatDate(row,columnValue) + }, + { + minWidth: 120, + prop: 'specs', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + label: '瑙勬牸鍨嬪彿', + }, + { + minWidth: 120, + prop: 'unit', + label: '鍗曚綅', + searchInfoType: 'text', + isTrue: true, + isSearch: true, + }, + { + minWidth: 120, + prop: 'number', + label: '鏁伴噺', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 120, + prop: 'productionStatus', + label: '鐢熶骇鎯呭喌', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 120, + prop: 'productionRoutine', + label: '鐢熶骇绋嬪害', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 120, + prop: 'projectLeader', + label: '椤圭洰璐熻矗浜�', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + }, + { + minWidth: 150, + prop: 'remark', + label: '澶囨敞', + isTrue: true, + isSearch: true, + searchInfoType: 'text', + } + ], + toolbar: [], + operator: null, + operatorConfig: { + fixed: 'right', + label: '鎿嶄綔', + width: 150, + minWidth: 150 + } + }, dropdownTitleStyle: { color: '#E84738', fontWeight: 'bold' @@ -224,272 +372,9 @@ dialogVisible: false, scheduleList: [], scheduleEditList: [], - typeOptions: [], multipleSelection: [], loading: true, - tableData: [], - finishedTableData: [], - page: { - total: 0, - currentPage: 1, - pageSize: 10, - pagerCount: 5 - }, - finishedPage: { - total: 0, - currentPage: 1, - pageSize: 10, - pagerCount: 5 - }, - option: { - defaultSort:{ - prop:'id', - order:'descending' - }, - height: 530, - selection: true, - columnBtn: false, - index: true, - indexFixed: false, - selectionFixed: false, - rowKey: 'mid', - indexLabel: '搴忓彿', - menuAlign: 'center', - menuWidth: 130, - editBtn: false, - delBtn: false, - addBtn: false, - border: true, - align: 'center', - column: [ - { - minWidth: 120, - prop: 'projectName', - label: '椤圭洰鍚嶇О', - overHidden: true, - }, - { - minWidth: 100, - prop: 'contractNo', - label: '鍚堝悓鍙�', - overHidden: true, - }, - { - minWidth: 120, - prop: 'orderTime', - label: '鎺ュ崟鏃ユ湡', - overHidden: true, - formatter: (row,columnValue)=> this.formatDate(row,columnValue) - }, - { - minWidth: 120, - prop: 'customerName', - label: '瀹㈡埛鍚嶇О', - overHidden: true, - }, - { - minWidth: 120, - prop: 'deliveryDate', - label: '浜よ揣鏃ユ湡', - overHidden: true, - formatter: (row,columnValue)=> this.formatDate(row,columnValue) - }, - { - minWidth: 120, - prop: 'productType', - label: '浜у搧绫诲瀷', - overHidden: true, - }, - { - minWidth: 120, - prop: 'product', - label: '浜у搧鍚�', - overHidden: true, - slot: true - }, - { - minWidth: 120, - prop: 'specs', - label: '瑙勬牸鍨嬪彿', - overHidden: true, - }, - { - minWidth: 120, - prop: 'unit', - label: '鍗曚綅', - overHidden: true, - }, - { - minWidth: 120, - prop: 'number', - label: '鏁伴噺', - overHidden: true, - }, - { - minWidth: 120, - prop: 'productionStatus', - label: '鐢熶骇鎯呭喌', - overHidden: true, - }, - { - minWidth: 120, - prop: 'productionRoutine', - label: '鐢熶骇绋嬪害', - overHidden: true, - }, - { - minWidth: 120, - prop: 'projectLeader', - label: '椤圭洰璐熻矗浜�', - overHidden: true, - }, - { - minWidth: 150, - prop: 'remark', - label: '澶囨敞', - overHidden: true, - } - ], - }, - finishedOption: { - refreshBtn: false, // 鏄惁鏄剧ず鍒锋柊鎸夐挳 - defaultSort:{ - prop:'id', - order:'descending' - }, - height: 230, - selection: true, - columnBtn: false, - index: true, - indexFixed: false, - selectionFixed: false, - rowKey: 'mid', - indexLabel: '搴忓彿', - menu: false, - menuAlign: 'center', - menuWidth: 130, - editBtn: false, - delBtn: false, - addBtn: false, - border: true, - align: 'center', - column: [ - { - minWidth: 120, - prop: 'projectName', - label: '椤圭洰鍚嶇О', - overHidden: true, - }, - { - minWidth: 100, - prop: 'contractNo', - label: '鍚堝悓鍙�', - overHidden: true, - }, - { - minWidth: 120, - prop: 'orderTime', - label: '鎺ュ崟鏃ユ湡', - overHidden: true, - formatter: (row,columnValue)=> this.formatDate(row,columnValue) - }, - { - minWidth: 120, - prop: 'customerName', - label: '瀹㈡埛鍚嶇О', - overHidden: true, - }, - { - minWidth: 120, - prop: 'deliveryDate', - label: '浜よ揣鏃ユ湡', - overHidden: true, - formatter: (row,columnValue)=> this.formatDate(row,columnValue) - }, - { - minWidth: 120, - prop: 'productType', - label: '浜у搧绫诲瀷', - overHidden: true, - }, - { - minWidth: 120, - prop: 'product', - label: '浜у搧鍚�', - overHidden: true, - slot: true - }, - { - minWidth: 120, - prop: 'specs', - label: '瑙勬牸鍨嬪彿', - overHidden: true, - }, - { - minWidth: 120, - prop: 'unit', - label: '鍗曚綅', - overHidden: true, - }, - { - minWidth: 120, - prop: 'number', - label: '鏁伴噺', - overHidden: true, - }, - { - minWidth: 120, - prop: 'productionStatus', - label: '鐢熶骇鎯呭喌', - overHidden: true, - }, - { - minWidth: 120, - prop: 'productionRoutine', - label: '鐢熶骇绋嬪害', - overHidden: true, - }, - { - minWidth: 120, - prop: 'projectLeader', - label: '椤圭洰璐熻矗浜�', - overHidden: true, - }, - { - minWidth: 150, - prop: 'remark', - label: '澶囨敞', - overHidden: true, - } - ], - }, - spanArr: [{ - prop: 'id', - span: [] - },{ - prop: 'projectName', - span: [] - }, { - prop: 'contractNo', - span: [] - }, - { - prop: 'orderTime', - span: [] - }, - { - prop: 'customerName', - span: [] - }, - { - prop: 'deliveryDate', - span: [] - }, - { - prop: 'productType', - span: [] - }, - ], + spanArr: ['id','projectName', 'contractNo','orderTime','customerName','deliveryDate','productType'], } }, components: { @@ -499,19 +384,8 @@ ...mapGetters(['permissions']), }, created(){ - if(!this.permissions.plan_productionschedul_edit && !this.permissions.plan_productionschedul_del){ - this.option.menu = false - } + this.showOperator() this.loading = true - this.getUnFinishedData() - this.getFinishedData() - this.getParamType() - // this.rowSort() - this.rowCalc() - }, - beforeUpdate() { - // this.rowSort() - this.rowCalc() }, watch:{ editDialogVisible(newVal){ @@ -529,25 +403,77 @@ } } }, - mounted() {}, - beforeDestroy() {}, methods: { - handleClickCell(row, column, cell, event){ - if(column.label === '浜у搧鍚�'){ - this.getScheduleById(row.mid) - this.showTimeLineDialog = true + showChangeRecords(row){ + this.recordsList = [] + if(row){ + fetchRecordsList(row.mid).then((res)=>{ + if(res.status===200){ + this.recordsList = res.data.data.records + } + }).catch((error)=>{ + console.error(error); + }) + } + this.showRecordsDialog = true + }, + showOperator(){ + this.table.operator = [{ + text: '鍙樻洿璁板綍', + type: 'text', + size: 'small', + fun: this.showChangeRecords, + }] + if(this.showUnDownTable){ + if(this.permissions.plan_productionschedul_edit){ + this.table.operator.push({ + text: '缂栬緫', + type: 'text', + size: 'small', + fun: this.editHandle, + show: { + key: 'hasEdit', + val: [true] + } + }) + } + if(this.permissions.plan_productionschedul_del){ + this.table.operator.push({ + text: '鍒犻櫎', + type: 'text', + size: 'small', + fun: this.deleteHandle, + show: { + key: 'hasEdit', + val: [true] + } + }) + } } }, + handleClickCell(row){ + this.getScheduleById(row.mid) + this.showTimeLineDialog = true + }, changeTable(command){ + const _than = this if(command === 'undone'){ this.dropdownTitle = '寰呭畬鎴愯皟搴�' this.dropdownTitleStyle = {color:'#E84738',fontWeight: 'bold'} this.showUnDownTable = true + this.queryParams.state = false + }else if(command === 'done'){ this.dropdownTitle = '宸插畬鎴愯皟搴�' this.dropdownTitleStyle = {color:'#34BD66',fontWeight: 'bold'} this.showUnDownTable = false + this.table.operator = null + this.queryParams.state = true } + this.$nextTick(()=>{ + _than.showOperator() + _than.getDataList() + }) }, tagFinished(){ if(this.multipleSelection.length < 1){ @@ -560,8 +486,7 @@ updateState(ids).then(res=>{ if(res.status===200){ this.$message.success("鏇存柊鎴愬姛") - this.getUnFinishedData() - this.getFinishedData() + this.getDataList() } }).catch(error=>{ console.error(error); @@ -634,8 +559,8 @@ }else{ _than.$message.error("鏇存柊澶辫触") } - // _than.getScheduleById(orderObj.id) _than.dialogVisible = false + _than.getDataList() }).catch(error=>{ console.error(error); }) @@ -690,20 +615,6 @@ }, selectionRow(val){ this.multipleSelection = val - // if(this.multipleSelection.length>0){ - // this.getScheduleById(val[val.length-1].mid) - // this.showTimeLineDialog = true - // } - }, - selectionFinishedRow(val){ - if (val.length > 1) { - const preVal = val.shift(); - this.$refs.finished.toggleRowSelection(preVal, false); - } - else{ - this.scheduleList=[] - } - this.getScheduleById(val[0].mid) }, formatDate(row, cellValue){ if (cellValue) { @@ -714,55 +625,9 @@ } return '' }, - handleSizeChange(val){ - if(val){ - this.page.pageSize=val - this.getUnFinishedData() - } - }, - handleCurrentChange(val){ - if(val){ - this.page.currentPage=val - this.getUnFinishedData() - } - }, // 鑾峰彇鏁版嵁鍒楄〃 getDataList(){ - this.getUnFinishedData() - this.getFinishedData() - this.$nextTick(()=>{ - this.rowCalc() - }) - }, - getUnFinishedData() { - this.loading = true - let param = { - size: this.page.pageSize, - current: this.page.currentPage, - state: false - } - fetchScheduleList(param).then((res) => { - this.tableData = res.data.data.records - this.page.total = res.data.data.total - this.page.currentPage = res.data.data.records.pages - this.scheduleList = [] - }) - this.loading = false - }, - getFinishedData() { - this.loading = true - let param = { - size: this.finishedPage.pageSize, - current: this.finishedPage.currentPage, - state: true - } - fetchScheduleList(param).then((res) => { - this.finishedTableData = res.data.data.records - this.finishedPage.total = res.data.data.total - this.finishedPage.currentPage = res.data.data.records.pages - this.scheduleList = [] - }) - this.loading = false + this.$refs.ttable.getDataList() }, // 鍒犻櫎 deleteHandle(row,index) { @@ -782,70 +647,6 @@ }) }) }, - //鍔ㄦ�佸悎骞舵柟娉� - rowCalc() { - this.spanArr.forEach((ele, index) => { - let parent - if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span - ele.span = this.rowSpan(ele.prop, parent) - }) - }, - rowSort() { - let propList = this.spanArr.map(ele => ele.prop) - this.spanArr.forEach((ele, index) => { - let key = ele.prop - this.tableData = this.tableData.sort((a, b) => { - let flag = true; - for (let i = 0; i < index; i++) { - let prop = this.spanArr[i].prop - flag = flag && a[prop] == b[prop] - } - if (flag) { - if (a[key] < b[key]) { return 1; } - else if (a[key] > b[key]) { return -1; } - return 0; - } - return 0; - }) - }) - }, - rowSpan(key, parent) { - let list = []; - let position = 0; - this.tableData.forEach((item, index) => { - if (index === 0) { - list.push(1) - let position = 0; - } else { - if (this.tableData[index][key] === this.tableData[index - 1][key]) { - if (parent && parent[index] !== 0) { - list.push(1) - position = index - } else { - list[position] += 1; - list.push(0) - } - } else { - list.push(1) - position = index - } - } - }) - return list - }, - spanMethod({ row, column, rowIndex, columnIndex }) { - for (let i = 0; i < this.spanArr.length; i++) { - const ele = this.spanArr[i] - if (column.property == ele.prop) { - const _row = ele.span[rowIndex]; - const _col = _row > 0 ? 1 : 0; - return { - rowspan: _row, - colspan: _col - } - } - } - } } } </script> -- Gitblit v1.9.3