From ff2f7d7bad0132c130c305364a863ff446e926b2 Mon Sep 17 00:00:00 2001 From: 小小儁爺 <1694218219@qq.com> Date: 星期一, 30 十二月 2024 13:47:24 +0800 Subject: [PATCH] 1.在缓存模式下 页面切换会请求接口 --- src/views/deviceManager/maintainPosition.vue | 1057 src/views/deviceManager/checkStandard.vue | 2703 +- vue.config.js | 4 src/views/mouldManager/mouldCheckStand.vue | 1431 src/views/statistic/workOrderProcess.vue | 952 src/views/basicSettings/processList.vue | 873 src/views/mouldManager/mouldMaintain.vue | 911 src/views/workOrder/produceOrderList.vue | 2 src/views/deviceManager/maintainRecord.vue | 1237 src/views/qualityManager/processCheckRecord.vue | 1467 src/views/workOrder/workOrderSend.vue | 1 src/views/statistic/defectDetailList.vue | 1219 src/views/statistic/personSalaryList.vue | 1807 src/views/mouldManager/mouldMaintainStand.vue | 1431 src/views/basicSettings/roleList.vue | 967 src/views/deviceManager/checkPosition.vue | 1221 src/views/statistic/subcontractingOperation.vue | 1318 src/views/basicSettings/groupList.vue | 721 src/views/basicSettings/storageList.vue | 1779 src/views/basicSettings/meterPrice.vue | 1419 src/views/basicSettings/postList.vue | 739 src/views/workOrder/workOrderClose.vue | 1 src/views/statistic/installationLampList.vue | 1915 src/views/attendanceModule/attendanceSettings.vue | 3 src/views/basicSettings/contactUnitList.vue | 960 src/views/qualityManager/defectDefine.vue | 717 src/views/basicSettings/roleDivider.vue | 1116 src/views/deviceManager/maintainStandard.vue | 2601 +- src/views/statistic/groupSalaryList.vue | 1839 src/views/basicSettings/installLampList.vue | 1201 src/views/systemSetting/encodingRules.vue | 936 src/views/produce/stepReport.vue | 2 src/views/systemSetting/processSetting.vue | 461 src/views/attendanceModule/attendanceMonth.vue | 2 src/views/materialManager/inventoryList.vue | 2 src/views/mouldManager/mouldCheckRecord.vue | 981 src/views/mouldManager/mouldCheck.vue | 905 src/views/mouldManager/mouldOutInRecord.vue | 997 src/views/deviceManager/repairRecord.vue | 1465 src/views/deviceManager/deviceList.vue | 1776 src/views/sopManager/sopDevice.vue | 988 src/views/materialManager/unitList.vue | 1383 src/views/qualityManager/qualityPlaning.vue | 2595 +- src/views/sopManager/sopRoute.vue | 1168 src/views/basicSettings/cronTime.vue | 1263 src/views/mouldManager/mouldList.vue | 1971 src/views/workOrder/workOrderList.vue | 1 src/views/produce/reportVerify.vue | 1138 src/views/attendanceModule/attendanceDay.vue | 3 src/views/attendanceModule/attendanceRecord.vue | 3 src/views/mouldManager/mouldRepairRecord.vue | 1461 src/views/produce/reportCorrect.vue | 1562 src/views/basicSettings/personList.vue | 3 src/views/mouldManager/mouldUpDownRecord.vue | 1005 src/views/deviceManager/checkRecord.vue | 1195 src/views/mouldManager/mouldMaintainRecord.vue | 989 src/views/qualityManager/processCheckItem.vue | 817 src/views/attendanceModule/attendanceClockIn.vue | 1 src/views/statistic/repairDetailList.vue | 1257 src/views/basicSettings/powerDivider.vue | 1101 src/views/basicSettings/processRoute.vue | 2043 src/views/qualityManager/processCheck.vue | 1609 src/views/basicSettings/organizationList.vue | 885 src/views/basicSettings/warehouseList.vue | 937 src/views/sopManager/sopWorkOrder.vue | 1043 src/views/mouldManager/mouldCirculateRecord.vue | 957 66 files changed, 34,453 insertions(+), 34,064 deletions(-) diff --git a/src/views/attendanceModule/attendanceClockIn.vue b/src/views/attendanceModule/attendanceClockIn.vue index e3485b7..e8791b9 100644 --- a/src/views/attendanceModule/attendanceClockIn.vue +++ b/src/views/attendanceModule/attendanceClockIn.vue @@ -124,6 +124,7 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.inputFocus() }, created() { }, diff --git a/src/views/attendanceModule/attendanceDay.vue b/src/views/attendanceModule/attendanceDay.vue index 9196fb2..474c3a7 100644 --- a/src/views/attendanceModule/attendanceDay.vue +++ b/src/views/attendanceModule/attendanceDay.vue @@ -457,6 +457,9 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getDailyWageReportSearch() + this.getPrentOrganizationNoCompany() + this.getPersonPermissions() }, created() { this.getDailyWageReportSearch() diff --git a/src/views/attendanceModule/attendanceMonth.vue b/src/views/attendanceModule/attendanceMonth.vue index b86eba5..0e3933d 100644 --- a/src/views/attendanceModule/attendanceMonth.vue +++ b/src/views/attendanceModule/attendanceMonth.vue @@ -392,6 +392,8 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getMonthlyWageReportSearch() + this.getPrentOrganizationNoCompany() }, created() { this.getMonthlyWageReportSearch() diff --git a/src/views/attendanceModule/attendanceRecord.vue b/src/views/attendanceModule/attendanceRecord.vue index c93302b..60bb0ea 100644 --- a/src/views/attendanceModule/attendanceRecord.vue +++ b/src/views/attendanceModule/attendanceRecord.vue @@ -354,6 +354,9 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getAttendanceRecordSearch() + this.getPrentOrganizationNoCompany() + this.getPersonPermissions() }, created() { this.getAttendanceRecordSearch() diff --git a/src/views/attendanceModule/attendanceSettings.vue b/src/views/attendanceModule/attendanceSettings.vue index b77a775..e0ba18a 100644 --- a/src/views/attendanceModule/attendanceSettings.vue +++ b/src/views/attendanceModule/attendanceSettings.vue @@ -394,6 +394,9 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getAttendanceSettSearch() + this.getPrentOrganizationNoCompany() + this.getPersonPermissions() }, created() { this.getAttendanceSettSearch() diff --git a/src/views/basicSettings/contactUnitList.vue b/src/views/basicSettings/contactUnitList.vue index 4bb81a3..854f0b2 100644 --- a/src/views/basicSettings/contactUnitList.vue +++ b/src/views/basicSettings/contactUnitList.vue @@ -7,8 +7,10 @@ <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> <div style="display: flex;"> - <div style="width: 5px;height: 100%;border-radius: 5px;" - :style="{background:$store.state.settings.theme}" /> + <div + style="width: 5px;height: 100%;border-radius: 5px;" + :style="{background:$store.state.settings.theme}" + /> <div style="margin-left: 8px;">寰�鏉ュ崟浣�</div> </div> @@ -20,19 +22,36 @@ </div> - <el-tree ref="treeLeftRef" style="padding: 10px;overflow: auto" :style="{height:(tableHeight+222)+'px'}" - :data="treeLeft" node-key="code" highlight-current :props="defaultPropsLeft" :default-expand-all="true" - :expand-on-click-node="false" @node-click="getTCunstomerData"> + <el-tree + ref="treeLeftRef" + style="padding: 10px;overflow: auto" + :style="{height:(tableHeight+222)+'px'}" + :data="treeLeft" + node-key="code" + highlight-current + :props="defaultPropsLeft" + :default-expand-all="true" + :expand-on-click-node="false" + @node-click="getTCunstomerData" + > <span slot-scope="{ node, data }" class="custom-tree-node"> <span v-if="!data.isEdit">{{ data.name }}</span> <span v-if="!data.isEdit"> <el-tooltip v-del-tab-index class="item" effect="dark" content="缂栬緫" placement="top"> - <i v-if="data.code!=='-1'" class="el-icon-edit" style="margin-right:10px;color: #999" - @click.stop="treeEditClick(node,data,'edit')" /> + <i + v-if="data.code!=='-1'" + class="el-icon-edit" + style="margin-right:10px;color: #999" + @click.stop="treeEditClick(node,data,'edit')" + /> </el-tooltip> <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i v-if="data.code!=='-1'" class="el-icon-delete" style="margin-right: 4px;color: #999" - @click.stop="treeDeleteClick(node,data)" /> + <i + v-if="data.code!=='-1'" + class="el-icon-delete" + style="margin-right: 4px;color: #999" + @click.stop="treeDeleteClick(node,data)" + /> </el-tooltip> </span> </span> @@ -43,8 +62,12 @@ <div class="bodyTopButtonGroup" style="justify-content: space-between"> <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> <div style="display: flex"> - <el-button v-waves type="success" icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=5')">瀵煎叆</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=5')" + >瀵煎叆</el-button> <el-button v-waves icon="el-icon-refresh-right" @click="syncERP">鍚屾寰�鏉ュ崟浣�</el-button> </div> @@ -81,10 +104,16 @@ <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> <!-- </el-form-item>--> </div> - <div class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" - @click="getTCunstomerData($refs.treeLeftRef.getCurrentNode())">鏌ヨ + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button + v-waves + type="primary" + icon="el-icon-search" + @click="getTCunstomerData($refs.treeLeftRef.getCurrentNode())" + >鏌ヨ </el-button> <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> </div> @@ -107,10 +136,19 @@ </div> <div class="elTableDiv"> - <el-table ref="tableDataRef" class="tableFixed" :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" border row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" highlight-current-row - :header-cell-style="this.$headerCellStyle" :cell-style="this.$cellStyle" @sort-change="sortChange"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > <!-- prop="RowNum"--> <el-table-column prop="rowNum" width="50" fixed label="搴忓彿" /> <el-table-column prop="code" label="寰�鏉ュ崟浣嶇紪鐮�" sortable="custom" /> @@ -152,8 +190,11 @@ <template slot-scope="{row}"> <div class="operationClass"> <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i class="el-icon-edit-outline" :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" /> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> </el-tooltip> <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" /> @@ -165,17 +206,31 @@ </div> <!--鍒嗛〉--> - <pagination :total="total" :page.sync="form.page" :limit.sync="form.rows" align="right" - layout="total,prev, pager, next,sizes,jumper" popper-class="select_bottom" - @pagination="getTCunstomerData($refs.treeLeftRef.getCurrentNode())" /> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getTCunstomerData($refs.treeLeftRef.getCurrentNode())" + /> </div> </div> </div> <!-- 寰�鏉ョ被鍒柊澧炰慨鏀�--> - <el-dialog v-el-drag-dialog :title="operation==='add'?'鏂板':'缂栬緫'" :visible.sync="dialogClassVisible" width="800px" - :close-on-click-modal="false" top="15vh" @closed="handleClassClose" @close="handleClassClose"> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogClassVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClassClose" + @close="handleClassClose" + > <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="80px"> <el-form-item label="鍒嗙被缂栫爜" prop="customerclasscode"> <el-input v-model="dialogClassForm.customerclasscode" :disabled="operation!=='add'" style="width: 200px" /> @@ -184,8 +239,13 @@ <el-input v-model="dialogClassForm.customerclassname" style="width: 200px" /> </el-form-item> <el-form-item label="涓婄骇鍒嗙被"> - <el-select v-model="dialogClassForm.parentcode" style="width:200px" placeholder="璇烽�夋嫨" - :popper-append-to-body="false" clearable> + <el-select + v-model="dialogClassForm.parentcode" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + clearable + > <el-option v-for="item in treeLeftArr" :key="item.code" :label="item.name" :value="item.code" /> </el-select> </el-form-item> @@ -194,15 +254,28 @@ <span slot="footer" class="dialog-footer"> <div class="footerButton"> <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button> - <el-button v-waves type="primary" :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" @click="dialogVisibleClassConfirm">纭� 瀹�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleClassConfirm" + >纭� 瀹�</el-button> </div> </span> </el-dialog> <!-- 寰�鏉ュ崟浣嶆柊澧炰慨鏀�--> - <el-dialog v-el-drag-dialog :title="operation==='add'?'鏂板':'缂栬緫'" :visible.sync="dialogVisible" width="800px" - :close-on-click-modal="false" top="15vh" @closed="handleClose" @close="handleClose"> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> <!-- <el-divider content-position="left">鍩烘湰淇℃伅</el-divider>--> @@ -214,8 +287,13 @@ </el-form-item> <el-form-item label="鎵�灞炵被鍒�" prop="customerclasscode"> - <el-select v-model="dialogForm.customerclasscode" style="width:200px" placeholder="璇烽�夋嫨" filterable - :popper-append-to-body="false"> + <el-select + v-model="dialogForm.customerclasscode" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + > <el-option v-for="item in treeLeftArr" :key="item.code" :label="item.name" :value="item.code" /> </el-select> </el-form-item> @@ -233,8 +311,12 @@ <el-input v-model="dialogForm.conttphone" style="width: 200px" /> </el-form-item> <el-form-item label="鍦板潃"> - <el-input v-model="dialogForm.addr" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" - style="width: 520px;" /> + <el-input + v-model="dialogForm.addr" + type="textarea" + :autosize="{ minRows: 2, maxRows: 4}" + style="width: 520px;" + /> </el-form-item> </el-form> @@ -242,8 +324,13 @@ <span slot="footer" class="dialog-footer"> <div class="footerButton"> <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button v-waves type="primary" :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" @click="dialogVisibleConfirm">纭� 瀹�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> </div> </span> </el-dialog> @@ -252,427 +339,428 @@ </template> <script> - import waves from '@/directive/waves' - import Pagination from '@/components/Pagination' - import { - validateCode - } from '@/utils/global' - import elDragDialog from '@/directive/el-drag-dialog' - import arrayToTree from 'array-to-tree' - import { - TCunstomerAddUpdate, - TCunstomerClassTree, - TCunstomerClassTreeAddUpdate, - TCunstomerClassTreeDelete, - TCunstomerData, - TCunstomerDelete - } from '@/api/basicSettings' - import { - SeaveSearchPartner - } from '@/api/ErpSyncMes' +import waves from '@/directive/waves' +import Pagination from '@/components/Pagination' +import { + validateCode +} from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import arrayToTree from 'array-to-tree' +import { + TCunstomerAddUpdate, + TCunstomerClassTree, + TCunstomerClassTreeAddUpdate, + TCunstomerClassTreeDelete, + TCunstomerData, + TCunstomerDelete +} from '@/api/basicSettings' +import { + SeaveSearchPartner +} from '@/api/ErpSyncMes' - export default { - name: 'ContactUnitList', - directives: { - waves, - elDragDialog - }, - components: { - Pagination - }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - operation: '', +export default { + name: 'ContactUnitList', + directives: { + waves, + elDragDialog + }, + components: { + Pagination + }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + operation: '', - treeLeft: [{ - code: '-1', - name: '鍏ㄩ儴' - }], // 宸︿晶鏍� - treeLeftArr: [], - defaultPropsLeft: { - children: 'children', - label: 'name' - }, + treeLeft: [{ + code: '-1', + name: '鍏ㄩ儴' + }], // 宸︿晶鏍� + treeLeftArr: [], + defaultPropsLeft: { + children: 'children', + label: 'name' + }, - tableData: [], - form: { - customerclasscode: '', - customercode: '', - customername: '', - partspec: '', - page: 1, - rows: 20, - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc' // 鎺掑簭瀛楁 - }, - total: 0, - dialogClassVisible: false, - dialogClassForm: { - data_sources: '', // 鏁版嵁鏉ユ簮:ERP/MES - customerclasscode: '', // 瀛樿揣鍒嗙被缂栫爜 - customerclassname: '', // 瀛樿揣鍒嗙被鍚嶇О - parentcode: '', // 涓婄骇鍒嗙被缂栫爜 - OperType: '' // OperType - }, - classArr: [], - dialogClassFormRules: { - customerclasscode: [{ - required: true, - validator: validateCode, - trigger: ['blur', 'change'] - }], - customerclassname: [{ - required: true, - message: '璇疯緭寰�鏉ュ崟浣嶅悕绉�', - trigger: ['blur', 'change'] - }] - }, + tableData: [], + form: { + customerclasscode: '', + customercode: '', + customername: '', + partspec: '', + page: 1, + rows: 20, + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc' // 鎺掑簭瀛楁 + }, + total: 0, + dialogClassVisible: false, + dialogClassForm: { + data_sources: '', // 鏁版嵁鏉ユ簮:ERP/MES + customerclasscode: '', // 瀛樿揣鍒嗙被缂栫爜 + customerclassname: '', // 瀛樿揣鍒嗙被鍚嶇О + parentcode: '', // 涓婄骇鍒嗙被缂栫爜 + OperType: '' // OperType + }, + classArr: [], + dialogClassFormRules: { + customerclasscode: [{ + required: true, + validator: validateCode, + trigger: ['blur', 'change'] + }], + customerclassname: [{ + required: true, + message: '璇疯緭寰�鏉ュ崟浣嶅悕绉�', + trigger: ['blur', 'change'] + }] + }, - dialogVisible: false, - dialogForm: { - data_sources: 'MES', // 鏁版嵁鏉ユ簮锛汦RP/MES - customercode: '', // - customername: '', // - customerclasscode: '', - conttacts: '', - conttphone: '', - addr: '', - status: '0', // 浣跨敤鐘舵��: 姝e父(0)鍋滅敤(1) - OperType: '' // 鎿嶄綔绫诲瀷 - }, - dialogFormRules: { - customercode: [{ - required: true, - validator: validateCode, - trigger: ['blur', 'change'] - }], - customername: [{ - required: true, - message: '璇疯緭鍏ュ線鏉ュ崟浣嶅悕绉�', - trigger: ['blur', 'change'] - }], - customerclasscode: [{ - required: true, - message: '璇烽�夋嫨鎵�灞炵被鍒�', - trigger: ['blur', 'change'] - }] - - } + dialogVisible: false, + dialogForm: { + data_sources: 'MES', // 鏁版嵁鏉ユ簮锛汦RP/MES + customercode: '', // + customername: '', // + customerclasscode: '', + conttacts: '', + conttphone: '', + addr: '', + status: '0', // 浣跨敤鐘舵��: 姝e父(0)鍋滅敤(1) + OperType: '' // 鎿嶄綔绫诲瀷 + }, + dialogFormRules: { + customercode: [{ + required: true, + validator: validateCode, + trigger: ['blur', 'change'] + }], + customername: [{ + required: true, + message: '璇疯緭鍏ュ線鏉ュ崟浣嶅悕绉�', + trigger: ['blur', 'change'] + }], + customerclasscode: [{ + required: true, + message: '璇烽�夋嫨鎵�灞炵被鍒�', + trigger: ['blur', 'change'] + }] } - }, - activated() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - created() { + } + }, - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getTCunstomerClassTree() + }, + created() { - this.getTCunstomerClassTree() - }, - methods: { - async getTCunstomerClassTree() { - const res = await TCunstomerClassTree() - res.data.forEach(i => { - i.idparent = i.idparent ? i.idparent : '-1' - }) - this.treeLeftArr = res.data - this.treeLeftArr.forEach(e => { - e.name = e.code + ' ' + e.name - }) - this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), { - parentProperty: 'idparent', - customID: 'code', - childrenProperty: 'children' - }) - console.log(JSON.stringify(this.treeLeft), 1) - this.$nextTick(() => { - this.$refs.treeLeftRef.setCurrentKey('-1') - this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - }) - }, - async getTCunstomerData(node) { - const result = this.getChildrenCodeMethod(node, []) - if (result.includes('-1')) { - result.shift() - } - this.form.customerclasscode = result.join(',') - const res = await TCunstomerData(this.form) + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() - this.tableData = res.data - this.total = res.count - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 280 - this.$refs.tableDataRef.doLayout() - }) - }, - sortChange({ - column, - prop, - order - }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - this.dialogForm.data_sources = row.data_sources - this.dialogForm.customercode = row.code - this.dialogForm.customername = row.name - this.dialogForm.customerclasscode = row.customertypecode - this.dialogForm.conttacts = row.conttacts - this.dialogForm.conttphone = row.conttphone - this.dialogForm.addr = row.addr - - this.dialogForm.status = row.status - }) - }, - del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - TCunstomerDelete({ - customercode: row.code, - data_sources: row.data_sources - }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - reset() { - this.form.customerclasscode = '' - this.form.customercode = '' - this.form.customername = '' + this.getTCunstomerClassTree() + }, + methods: { + async getTCunstomerClassTree() { + const res = await TCunstomerClassTree() + res.data.forEach(i => { + i.idparent = i.idparent ? i.idparent : '-1' + }) + this.treeLeftArr = res.data + this.treeLeftArr.forEach(e => { + e.name = e.code + ' ' + e.name + }) + this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), { + parentProperty: 'idparent', + customID: 'code', + childrenProperty: 'children' + }) + console.log(JSON.stringify(this.treeLeft), 1) + this.$nextTick(() => { this.$refs.treeLeftRef.setCurrentKey('-1') this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.data_sources = 'MES' - this.dialogForm.customercode = '' - this.dialogForm.customername = '' - this.dialogForm.customerclasscode = '' - this.dialogForm.conttacts = '' - this.dialogForm.conttphone = '' - this.dialogForm.addr = '' - this.dialogForm.status = '0' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 2) - this.$store.state.app.buttonIsDisabled = true - TCunstomerAddUpdate(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) + }) + }, + async getTCunstomerData(node) { + const result = this.getChildrenCodeMethod(node, []) + if (result.includes('-1')) { + result.shift() + } + this.form.customerclasscode = result.join(',') + const res = await TCunstomerData(this.form) + + this.tableData = res.data + this.total = res.count + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 280 + this.$refs.tableDataRef.doLayout() + }) + }, + sortChange({ + column, + prop, + order + }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + this.dialogForm.data_sources = row.data_sources + this.dialogForm.customercode = row.code + this.dialogForm.customername = row.name + this.dialogForm.customerclasscode = row.customertypecode + this.dialogForm.conttacts = row.conttacts + this.dialogForm.conttphone = row.conttphone + this.dialogForm.addr = row.addr + + this.dialogForm.status = row.status + }) + }, + del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + TCunstomerDelete({ + customercode: row.code, + data_sources: row.data_sources + }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) } }) - }, - - // 閫掑綊鍙栧瓙闆嗙殑鎵�鏈塩ode - getChildrenCodeMethod(node, result) { - result.push(node.code) - if (node.children && node.children.length > 0) { - node.children.forEach(i => { - this.getChildrenCodeMethod(i, result) - }) - } - return result - }, - - treeEditClick(node, data, operation) { - this.dialogClassForm.data_sources = data.data_sources - this.dialogClassForm.customerclasscode = data.code - this.dialogClassForm.customerclassname = data.name.split(' ')[1] - this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent - this.dialogClassForm.OperType = 'Update' - this.operation = operation - this.dialogClassVisible = true - }, - treeDeleteClick(node, data) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const result = this.getChildrenCodeMethod(data, []) - TCunstomerClassTreeDelete({ - customerclasscode: result.join(',') - }).then(res => { + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + reset() { + this.form.customerclasscode = '' + this.form.customercode = '' + this.form.customername = '' + this.$refs.treeLeftRef.setCurrentKey('-1') + this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.data_sources = 'MES' + this.dialogForm.customercode = '' + this.dialogForm.customername = '' + this.dialogForm.customerclasscode = '' + this.dialogForm.conttacts = '' + this.dialogForm.conttphone = '' + this.dialogForm.addr = '' + this.dialogForm.status = '0' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 2) + this.$store.state.app.buttonIsDisabled = true + TCunstomerAddUpdate(this.dialogForm).then(res => { if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getTCunstomerClassTree() + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') } }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - treeAddClick(operation) { - this.operation = operation - this.dialogClassVisible = true - this.dialogClassForm.OperType = 'Add' - this.dialogClassForm.data_sources = 'MES' - }, - - handleClassClose() { - this.dialogClassForm.data_sources = '' - this.dialogClassForm.customerclasscode = '' - this.dialogClassForm.customerclassname = '' - this.dialogClassForm.parentcode = '' - this.dialogClassForm.OperType = '' - this.$refs.dialogClassForm.clearValidate() - }, - dialogVisibleClassCancel() { - this.dialogClassVisible = false - }, - dialogVisibleClassConfirm() { - this.$refs.dialogClassForm.validate(valid => { - if (valid) { - TCunstomerClassTreeAddUpdate(this.dialogClassForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogClassVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getTCunstomerClassTree() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - unittypcodeChange(val) { - console.log(val) - - this.dialogForm.unitcode = '' - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - this.dialogForm.idUnitByStock = '' - this.dialogForm.idUnitByPurchase = '' - this.dialogForm.idUnitBySale = '' - this.dialogForm.idunitbymanufacture = '' - // this.$refs.dialogForm.clearValidate() - // this.$forceUpdate() - }, - unitcodeChange(val, type) { - console.log(val) - - if (type === '1') { - // this.dialogForm.unitcode = val - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - - const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname - - this.dialogForm.idUnitByStock = unitname - this.dialogForm.idUnitByPurchase = unitname - this.dialogForm.idUnitBySale = unitname - this.dialogForm.idunitbymanufacture = unitname } + }) + }, - if (type === '0') { - const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children - - this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') - this.idUnitBvStockArr = t - - const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode - this.dialogForm.unitsubcode = mainUnitCode - this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode - - this.dialogForm.idUnitByStock = mainUnitCode - this.dialogForm.idUnitByPurchase = mainUnitCode - this.dialogForm.idUnitBySale = mainUnitCode - this.dialogForm.idunitbymanufacture = mainUnitCode - } - }, - // 鍚屾ERP - syncERP() { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍚屾ERP锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - - SeaveSearchPartner().then(res => { - if (res.code === '200') { - setTimeout(() => { - this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) - this.getTCunstomerClassTree() - loading.close() - this.$notify.success('鍚屾鎴愬姛锛�') - }, 2000) - } - // else if (res.code === '300') { - // setTimeout(() => { - // loading.close() - // this.$message.error('鍚屾澶辫触锛�') - // }, 10000) - // } - }).catch(e => { - loading.close() + // 閫掑綊鍙栧瓙闆嗙殑鎵�鏈塩ode + getChildrenCodeMethod(node, result) { + result.push(node.code) + if (node.children && node.children.length > 0) { + node.children.forEach(i => { + this.getChildrenCodeMethod(i, result) }) } + return result + }, + + treeEditClick(node, data, operation) { + this.dialogClassForm.data_sources = data.data_sources + this.dialogClassForm.customerclasscode = data.code + this.dialogClassForm.customerclassname = data.name.split(' ')[1] + this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent + this.dialogClassForm.OperType = 'Update' + this.operation = operation + this.dialogClassVisible = true + }, + treeDeleteClick(node, data) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const result = this.getChildrenCodeMethod(data, []) + TCunstomerClassTreeDelete({ + customerclasscode: result.join(',') + }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getTCunstomerClassTree() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + treeAddClick(operation) { + this.operation = operation + this.dialogClassVisible = true + this.dialogClassForm.OperType = 'Add' + this.dialogClassForm.data_sources = 'MES' + }, + + handleClassClose() { + this.dialogClassForm.data_sources = '' + this.dialogClassForm.customerclasscode = '' + this.dialogClassForm.customerclassname = '' + this.dialogClassForm.parentcode = '' + this.dialogClassForm.OperType = '' + this.$refs.dialogClassForm.clearValidate() + }, + dialogVisibleClassCancel() { + this.dialogClassVisible = false + }, + dialogVisibleClassConfirm() { + this.$refs.dialogClassForm.validate(valid => { + if (valid) { + TCunstomerClassTreeAddUpdate(this.dialogClassForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogClassVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getTCunstomerClassTree() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + unittypcodeChange(val) { + console.log(val) + + this.dialogForm.unitcode = '' + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + this.dialogForm.idUnitByStock = '' + this.dialogForm.idUnitByPurchase = '' + this.dialogForm.idUnitBySale = '' + this.dialogForm.idunitbymanufacture = '' + // this.$refs.dialogForm.clearValidate() + // this.$forceUpdate() + }, + unitcodeChange(val, type) { + console.log(val) + + if (type === '1') { + // this.dialogForm.unitcode = val + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + + const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname + + this.dialogForm.idUnitByStock = unitname + this.dialogForm.idUnitByPurchase = unitname + this.dialogForm.idUnitBySale = unitname + this.dialogForm.idunitbymanufacture = unitname + } + + if (type === '0') { + const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children + + this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') + this.idUnitBvStockArr = t + + const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode + this.dialogForm.unitsubcode = mainUnitCode + this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode + + this.dialogForm.idUnitByStock = mainUnitCode + this.dialogForm.idUnitByPurchase = mainUnitCode + this.dialogForm.idUnitBySale = mainUnitCode + this.dialogForm.idunitbymanufacture = mainUnitCode + } + }, + // 鍚屾ERP + syncERP() { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍚屾ERP锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + + SeaveSearchPartner().then(res => { + if (res.code === '200') { + setTimeout(() => { + this.getTCunstomerData(this.$refs.treeLeftRef.getCurrentNode()) + this.getTCunstomerClassTree() + loading.close() + this.$notify.success('鍚屾鎴愬姛锛�') + }, 2000) + } + // else if (res.code === '300') { + // setTimeout(() => { + // loading.close() + // this.$message.error('鍚屾澶辫触锛�') + // }, 10000) + // } + }).catch(e => { + loading.close() + }) } } +} </script> <style scoped lang="scss"> diff --git a/src/views/basicSettings/cronTime.vue b/src/views/basicSettings/cronTime.vue index ae6683e..b828741 100644 --- a/src/views/basicSettings/cronTime.vue +++ b/src/views/basicSettings/cronTime.vue @@ -1,629 +1,634 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板浠诲姟</el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-switch-button" @click="">鏆傚仠浠诲姟</el-button>--> - <!-- <el-button v-waves type="primary" icon="el-icon-caret-right " @click="">寮�鍚换鍔�</el-button>--> - <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="">绔嬪嵆鎵ц</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="姣嶄欢缂栫爜" style=" display: flex;"> - <el-input v-model="form.OrgCode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="姣嶄欢鍚嶇О" style=" display: flex;"> - <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="姣嶄欢瑙勬牸" style=" display: flex;"> - <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍚敤鐘舵��" style=" display: flex;"> - <el-select v-model="form.OrgType" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in OrgTypeArrxx" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐗堟湰缂栧彿" style=" display: flex;"> - <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;"> - <el-input v-model="form.UserName" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鍒涘缓鏃ユ湡" style=" display: flex;"> - <el-date-picker - v-model="form.createdate" - style="width: 200px" - type="date" - placeholder="閫夋嫨鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - type="index" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="TaskName" - label="浣滀笟鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="GroupName" - label="鍒嗙粍" - sortable="custom" - /> - <el-table-column - prop="LastRunTime" - label="鏈�鍚庢墽琛屾椂闂�" - sortable="custom" - min-width="120" - /> - <el-table-column - prop="Interval" - label="闂撮殧" - sortable="custom" - /> - <el-table-column - prop="Status" - label="鐘舵��" - width="75" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.Status===0" size="medium" type="success">姝e父</el-tag> - <el-tag v-if="row.Status===1" size="medium" type="danger">鏆傚仠</el-tag> - </template> - </el-table-column> - <el-table-column - prop="Describe" - label="鎻忚堪" - sortable="custom" - /> - <el-table-column - prop="ApiUrl" - label="ApiUrl" - sortable="custom" - /> - <el-table-column - prop="RequestType" - label="璇锋眰鏂瑰紡" - sortable="custom" - /> - - <el-table-column - label="鎿嶄綔" - width="200" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="鏆傚仠浠诲姟" placement="top"> - <i - class="el-icon-switch-button" - style="margin-right: 15px;color: RED;cursor: pointer" - @click="pauseTask(row)" - /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="寮�鍚换鍔�" placement="top"> - <i - class="el-icon-caret-right" - style="margin-right: 15px;color: #42B983;cursor: pointer" - @click="startTask(row)" - /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="绔嬪嵆鎵ц" placement="top"> - <i - class="el-icon-d-arrow-right" - style="margin-right: 15px;color: #42B983;cursor: pointer" - @click="runTask(row)" - /> - </el-tooltip> - - <el-tooltip class="item" effect="dark" content="鏌ョ湅璁板綍" placement="top"> - <i - class="el-icon-document" - style="margin-right: 15px;color: #42B983;cursor: pointer" - @click="check(row)" - /> - </el-tooltip> - - <el-tooltip class="item" effect="dark" content="缂栬緫浠诲姟" placement="top"> - <i class="el-icon-edit-outline" :style="{color:$store.state.settings.theme}" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" :style="{color:$store.state.settings.theme}" content="鍒犻櫎浠诲姟" placement="top"> - <i class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getTaskBackGroundGetJobs" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="900px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> - <el-form-item label="浣滀笟鍚嶇О" prop="TaskName"> - <el-input v-model="dialogForm.TaskName" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍒嗙粍" prop="GroupName"> - <el-input v-model="dialogForm.GroupName" style="width: 200px" /> - </el-form-item> - - <!-- <el-popover v-model="cronPopover">--> - <!-- <cron i18n="cn" @change="changeCron" @close="cronPopover=false" />--> - <!-- <el-form-item slot="reference" label="cron琛ㄨ揪寮�" prop="Interval">--> - <!-- <el-input--> - <!-- v-model="dialogForm.Interval"--> - <!-- placeholder="璇疯緭鍏ュ畾鏃剁瓥鐣�"--> - <!-- style="width:200px"--> - <!-- @click="cronPopover=true"--> - <!-- />--> - <!-- </el-form-item>--> - <!-- </el-popover>--> - - <el-form-item label="cron琛ㄨ揪寮�" prop="Interval"> - <el-input - v-model="dialogForm.Interval" - placeholder="璇疯緭鍏ュ畾鏃剁瓥鐣�" - style="width:200px" - readonly - > - <el-button slot="append" icon="el-icon-thumb" @click="showDialog" /> - </el-input> - </el-form-item> - - <el-form-item label="ApiUrl" prop="ApiUrl"> - <el-input v-model="dialogForm.ApiUrl" style="width: 200px" /> - </el-form-item> - <el-form-item label="header(Key)" prop="AuthKey"> - <el-input v-model="dialogForm.AuthKey" style="width: 200px" /> - </el-form-item> - <el-form-item label="header(value)" prop="AuthValue"> - <el-input v-model="dialogForm.AuthValue" style="width: 200px" /> - </el-form-item> - - <!-- <el-form-item label="璇锋眰鏂瑰紡" prop="RequestType">--> - <!-- <el-input v-model="dialogForm.RequestType" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="鎻忚堪" prop="Describe"> - <el-input v-model="dialogForm.Describe" type="textarea" style="width: 200px" /> - </el-form-item> - - </el-form> - - <el-dialog - v-el-drag-dialog - :close-on-click-modal="false" - top="8vh" - width="900px" - title="鐢熸垚 cron" - :visible.sync="showCron" - append-to-body - > - <vcrontab :expression="expression" @hide="showCron=false" @fill="crontabFill" /> - </el-dialog> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="cron 鎵ц璁板綍" - :visible.sync="dialogVisible2" - width="900px" - - top="15vh" - @closed="handleClose2" - @close="handleClose2" - > - <!-- :close-on-click-modal="false"--> - <!-- {{ recordData }}--> - - <el-timeline :reverse="false"> - <el-timeline-item - v-for="(item, index) in recordData" - :key="item.BeginDate" - :timestamp="item.Msg" - > - {{ item.BeginDate }} - </el-timeline-item> - </el-timeline> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible2=false">杩� 鍥�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - TaskBackGroundAdd, - TaskBackGroundGetJobs, - TaskBackGroundGetRunLog, - TaskBackGroundPause, - TaskBackGroundRemove, TaskBackGroundRun, - TaskBackGroundStart, TaskBackGroundUpdate -} from '@/api/TaskBackGround' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { cron } from 'vue-cron' -import cronstrue from 'cronstrue/i18n' -import vcrontab from '../../components/VcronTab/index' - -export default { - name: 'CronTime', - components: { - Pagination, cron, vcrontab - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - OrgCode: '', // 缁勭粐鏋舵瀯浠g爜 - OrgName: '', // 缁勭粐鏋舵瀯鍚嶇О - OrgType: '', // 缁勭粐绫诲瀷 - UserName: '', // 鍒涘缓浜哄憳 - createdate: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - TaskName: '', // 浣滀笟鍚嶇О - GroupName: '', // 鍒嗙粍 - Interval: '', // 闂撮殧 - ApiUrl: '', // ApiUrl - AuthKey: '', // AuthKey - AuthValue: '', // AuthValue - Describe: '', // 鎻忚堪 - RequestType: 'POST', // 璇锋眰绫诲瀷 - LastRunTime: '', // 鏈�鍚庢墽琛屾椂闂� - Status: 0// 鐘舵�� - }, - cronPopover: false, - - showCron: false, - expression: '', - - operation: '', - dialogFormRules: { - TaskName: [ - { required: true, message: '璇疯緭鍏ヤ綔涓氫换鍔�', trigger: ['blur', 'change'] } - ], - GroupName: [ - { required: true, message: '璇疯緭鍏ュ垎缁�', trigger: ['blur', 'change'] } - ], - Interval: [ - { required: true, message: '璇疯緭鍏ron琛ㄨ揪寮�', trigger: ['blur', 'change'] } - ], - ApiUrl: [ - { required: true, message: '璇疯緭鍏piUrl', trigger: ['blur', 'change'] } - ], - RequestType: [ - { required: true, message: '璇疯緭鍏ヨ姹傛柟寮�', trigger: ['blur', 'change'] } - ], - Describe: [ - { required: true, message: '璇疯緭鍏ヨ姹傛弿杩�', trigger: ['blur', 'change'] } - ] - // AuthKey: [ - // { required: true, message: '璇疯緭鍏uthKey', trigger: ['blur', 'change'] } - // ], - // AuthValue: [ - // { required: true, message: '璇疯緭鍏uthValue', trigger: ['blur', 'change'] } - // ] - - }, - dialogVisible2: false, - OrgTypeArrxx: [], - recordData: []// 鏌ョ湅璁板綍鏁扮粍 - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getTaskBackGroundGetJobs() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - crontabFill(val) { - this.dialogForm.Interval = val - // const t = cronstrue.toString(this.dialogForm.Interval, { locale: 'zh_CN' }) - // console.log(t) - }, - showDialog() { - this.expression = this.dialogForm.Interval - // 浼犲叆鐨� cron 琛ㄨ揪寮忥紝鍙互鍙嶈В鏋愬埌 UI 涓� - this.showCron = true - }, - changeCron(val) { - this.dialogForm.Interval = val - // cronstrue 鏄竴涓� JavaScript 搴擄紝瑙f瀽 cron 琛ㄨ揪寮忓苟杈撳嚭鍙鐨� cron 鎻忚堪銆� - // const t = cronstrue.toString(this.dialogForm.Interval, { locale: 'zh_CN' }) - // console.log(t) - }, - async getTaskBackGroundGetJobs() { - const res = await TaskBackGroundGetJobs() - this.tableData = res.data - this.total = res.data.length - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getTaskBackGroundGetJobs() - }, - // 鏌ヨ - search() { - this.getTaskBackGroundGetJobs() - }, - // 閲嶇疆 - reset() { - this.form.OrgCode = '' - this.form.OrgName = '' - this.form.OrgType = '' - this.form.UserName = '' - this.getTaskBackGroundGetJobs() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.$nextTick(() => { - this.dialogForm.TaskName = row.TaskName - this.dialogForm.GroupName = row.GroupName - this.dialogForm.Interval = row.Interval - this.dialogForm.ApiUrl = row.ApiUrl - this.dialogForm.AuthKey = row.AuthKey - this.dialogForm.AuthValue = row.AuthValue - this.dialogForm.Describe = row.Describe - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - TaskBackGroundRemove(row).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getTaskBackGroundGetJobs() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 鏆傚仠浠诲姟 - async pauseTask(row) { - const res = await TaskBackGroundPause(row) - if (res.code === '200') { - await this.getTaskBackGroundGetJobs() - return this.$message.success(res.message) - } - }, - // 寮�鍚换鍔� - async startTask(row) { - const res = await TaskBackGroundStart(row) - if (res.code === '200') { - await this.getTaskBackGroundGetJobs() - return this.$message.success(res.message) - } - }, - // 绔嬪嵆鎵ц - async runTask(row) { - const res = await TaskBackGroundRun(row) - if (res.code === '200') { - await this.getTaskBackGroundGetJobs() - this.$message.success(res.message) - } - }, - // 鏌ョ湅璁板綍 - async check(row) { - const data = { - TaskName: row.TaskName, - GroupName: row.GroupName, - page: 1 - } - const res = await TaskBackGroundGetRunLog(data) - - if (res.code === '200') { - this.recordData = res.data - this.dialogVisible2 = true - } - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.TaskName = '' - this.dialogForm.GroupName = '' - this.dialogForm.Interval = '' - this.dialogForm.ApiUrl = '' - this.dialogForm.AuthKey = '' - this.dialogForm.AuthValue = '' - this.dialogForm.Describe = '' - this.dialogForm.RequestType = 'POST' - this.dialogForm.LastRunTime = '' - this.dialogForm.Status = 0 - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - console.log(this.dialogForm) - - // console.log(new Date().getUTCDate()) - - this.$refs.dialogForm.validate(valid => { - if (valid) { - // const data = { - // OrganCode: this.dialogForm.OrgCode, - // OrganName: this.dialogForm.OrgName, - // OperType: this.operation === 'add' ? 'Add' : 'Update', - // Operator: getCookie('admin') - // } - - if (this.operation === 'add') { - TaskBackGroundAdd(this.dialogForm).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getTaskBackGroundGetJobs() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } else { - TaskBackGroundUpdate(this.dialogForm).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getTaskBackGroundGetJobs() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - } - }) - }, - handleClose2() { - this.recordData = [] - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style lang="scss" scoped> -::v-deep .pop_btn { - display: flex; - justify-content: right; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板浠诲姟</el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-switch-button" @click="">鏆傚仠浠诲姟</el-button>--> + <!-- <el-button v-waves type="primary" icon="el-icon-caret-right " @click="">寮�鍚换鍔�</el-button>--> + <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="">绔嬪嵆鎵ц</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="姣嶄欢缂栫爜" style=" display: flex;"> + <el-input v-model="form.OrgCode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="姣嶄欢鍚嶇О" style=" display: flex;"> + <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="姣嶄欢瑙勬牸" style=" display: flex;"> + <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍚敤鐘舵��" style=" display: flex;"> + <el-select v-model="form.OrgType" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in OrgTypeArrxx" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐗堟湰缂栧彿" style=" display: flex;"> + <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;"> + <el-input v-model="form.UserName" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鍒涘缓鏃ユ湡" style=" display: flex;"> + <el-date-picker + v-model="form.createdate" + style="width: 200px" + type="date" + placeholder="閫夋嫨鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + type="index" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="TaskName" + label="浣滀笟鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="GroupName" + label="鍒嗙粍" + sortable="custom" + /> + <el-table-column + prop="LastRunTime" + label="鏈�鍚庢墽琛屾椂闂�" + sortable="custom" + min-width="120" + /> + <el-table-column + prop="Interval" + label="闂撮殧" + sortable="custom" + /> + <el-table-column + prop="Status" + label="鐘舵��" + width="75" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.Status===0" size="medium" type="success">姝e父</el-tag> + <el-tag v-if="row.Status===1" size="medium" type="danger">鏆傚仠</el-tag> + </template> + </el-table-column> + <el-table-column + prop="Describe" + label="鎻忚堪" + sortable="custom" + /> + <el-table-column + prop="ApiUrl" + label="ApiUrl" + sortable="custom" + /> + <el-table-column + prop="RequestType" + label="璇锋眰鏂瑰紡" + sortable="custom" + /> + + <el-table-column + label="鎿嶄綔" + width="200" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="鏆傚仠浠诲姟" placement="top"> + <i + class="el-icon-switch-button" + style="margin-right: 15px;color: RED;cursor: pointer" + @click="pauseTask(row)" + /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="寮�鍚换鍔�" placement="top"> + <i + class="el-icon-caret-right" + style="margin-right: 15px;color: #42B983;cursor: pointer" + @click="startTask(row)" + /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="绔嬪嵆鎵ц" placement="top"> + <i + class="el-icon-d-arrow-right" + style="margin-right: 15px;color: #42B983;cursor: pointer" + @click="runTask(row)" + /> + </el-tooltip> + + <el-tooltip class="item" effect="dark" content="鏌ョ湅璁板綍" placement="top"> + <i + class="el-icon-document" + style="margin-right: 15px;color: #42B983;cursor: pointer" + @click="check(row)" + /> + </el-tooltip> + + <el-tooltip class="item" effect="dark" content="缂栬緫浠诲姟" placement="top"> + <i class="el-icon-edit-outline" :style="{color:$store.state.settings.theme}" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" :style="{color:$store.state.settings.theme}" content="鍒犻櫎浠诲姟" placement="top"> + <i class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getTaskBackGroundGetJobs" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="900px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> + <el-form-item label="浣滀笟鍚嶇О" prop="TaskName"> + <el-input v-model="dialogForm.TaskName" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍒嗙粍" prop="GroupName"> + <el-input v-model="dialogForm.GroupName" style="width: 200px" /> + </el-form-item> + + <!-- <el-popover v-model="cronPopover">--> + <!-- <cron i18n="cn" @change="changeCron" @close="cronPopover=false" />--> + <!-- <el-form-item slot="reference" label="cron琛ㄨ揪寮�" prop="Interval">--> + <!-- <el-input--> + <!-- v-model="dialogForm.Interval"--> + <!-- placeholder="璇疯緭鍏ュ畾鏃剁瓥鐣�"--> + <!-- style="width:200px"--> + <!-- @click="cronPopover=true"--> + <!-- />--> + <!-- </el-form-item>--> + <!-- </el-popover>--> + + <el-form-item label="cron琛ㄨ揪寮�" prop="Interval"> + <el-input + v-model="dialogForm.Interval" + placeholder="璇疯緭鍏ュ畾鏃剁瓥鐣�" + style="width:200px" + readonly + > + <el-button slot="append" icon="el-icon-thumb" @click="showDialog" /> + </el-input> + </el-form-item> + + <el-form-item label="ApiUrl" prop="ApiUrl"> + <el-input v-model="dialogForm.ApiUrl" style="width: 200px" /> + </el-form-item> + <el-form-item label="header(Key)" prop="AuthKey"> + <el-input v-model="dialogForm.AuthKey" style="width: 200px" /> + </el-form-item> + <el-form-item label="header(value)" prop="AuthValue"> + <el-input v-model="dialogForm.AuthValue" style="width: 200px" /> + </el-form-item> + + <!-- <el-form-item label="璇锋眰鏂瑰紡" prop="RequestType">--> + <!-- <el-input v-model="dialogForm.RequestType" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="鎻忚堪" prop="Describe"> + <el-input v-model="dialogForm.Describe" type="textarea" style="width: 200px" /> + </el-form-item> + + </el-form> + + <el-dialog + v-el-drag-dialog + :close-on-click-modal="false" + top="8vh" + width="900px" + title="鐢熸垚 cron" + :visible.sync="showCron" + append-to-body + > + <vcrontab :expression="expression" @hide="showCron=false" @fill="crontabFill" /> + </el-dialog> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="cron 鎵ц璁板綍" + :visible.sync="dialogVisible2" + width="900px" + + top="15vh" + @closed="handleClose2" + @close="handleClose2" + > + <!-- :close-on-click-modal="false"--> + <!-- {{ recordData }}--> + + <el-timeline :reverse="false"> + <el-timeline-item + v-for="(item, index) in recordData" + :key="item.BeginDate" + :timestamp="item.Msg" + > + {{ item.BeginDate }} + </el-timeline-item> + </el-timeline> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible2=false">杩� 鍥�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + TaskBackGroundAdd, + TaskBackGroundGetJobs, + TaskBackGroundGetRunLog, + TaskBackGroundPause, + TaskBackGroundRemove, TaskBackGroundRun, + TaskBackGroundStart, TaskBackGroundUpdate +} from '@/api/TaskBackGround' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { cron } from 'vue-cron' +import cronstrue from 'cronstrue/i18n' +import vcrontab from '../../components/VcronTab/index' + +export default { + name: 'CronTime', + components: { + Pagination, cron, vcrontab + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + OrgCode: '', // 缁勭粐鏋舵瀯浠g爜 + OrgName: '', // 缁勭粐鏋舵瀯鍚嶇О + OrgType: '', // 缁勭粐绫诲瀷 + UserName: '', // 鍒涘缓浜哄憳 + createdate: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + TaskName: '', // 浣滀笟鍚嶇О + GroupName: '', // 鍒嗙粍 + Interval: '', // 闂撮殧 + ApiUrl: '', // ApiUrl + AuthKey: '', // AuthKey + AuthValue: '', // AuthValue + Describe: '', // 鎻忚堪 + RequestType: 'POST', // 璇锋眰绫诲瀷 + LastRunTime: '', // 鏈�鍚庢墽琛屾椂闂� + Status: 0// 鐘舵�� + }, + cronPopover: false, + + showCron: false, + expression: '', + + operation: '', + dialogFormRules: { + TaskName: [ + { required: true, message: '璇疯緭鍏ヤ綔涓氫换鍔�', trigger: ['blur', 'change'] } + ], + GroupName: [ + { required: true, message: '璇疯緭鍏ュ垎缁�', trigger: ['blur', 'change'] } + ], + Interval: [ + { required: true, message: '璇疯緭鍏ron琛ㄨ揪寮�', trigger: ['blur', 'change'] } + ], + ApiUrl: [ + { required: true, message: '璇疯緭鍏piUrl', trigger: ['blur', 'change'] } + ], + RequestType: [ + { required: true, message: '璇疯緭鍏ヨ姹傛柟寮�', trigger: ['blur', 'change'] } + ], + Describe: [ + { required: true, message: '璇疯緭鍏ヨ姹傛弿杩�', trigger: ['blur', 'change'] } + ] + // AuthKey: [ + // { required: true, message: '璇疯緭鍏uthKey', trigger: ['blur', 'change'] } + // ], + // AuthValue: [ + // { required: true, message: '璇疯緭鍏uthValue', trigger: ['blur', 'change'] } + // ] + + }, + dialogVisible2: false, + OrgTypeArrxx: [], + recordData: []// 鏌ョ湅璁板綍鏁扮粍 + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getTaskBackGroundGetJobs() + }, + created() { + this.getTaskBackGroundGetJobs() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + crontabFill(val) { + this.dialogForm.Interval = val + // const t = cronstrue.toString(this.dialogForm.Interval, { locale: 'zh_CN' }) + // console.log(t) + }, + showDialog() { + this.expression = this.dialogForm.Interval + // 浼犲叆鐨� cron 琛ㄨ揪寮忥紝鍙互鍙嶈В鏋愬埌 UI 涓� + this.showCron = true + }, + changeCron(val) { + this.dialogForm.Interval = val + // cronstrue 鏄竴涓� JavaScript 搴擄紝瑙f瀽 cron 琛ㄨ揪寮忓苟杈撳嚭鍙鐨� cron 鎻忚堪銆� + // const t = cronstrue.toString(this.dialogForm.Interval, { locale: 'zh_CN' }) + // console.log(t) + }, + async getTaskBackGroundGetJobs() { + const res = await TaskBackGroundGetJobs() + this.tableData = res.data + this.total = res.data.length + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getTaskBackGroundGetJobs() + }, + // 鏌ヨ + search() { + this.getTaskBackGroundGetJobs() + }, + // 閲嶇疆 + reset() { + this.form.OrgCode = '' + this.form.OrgName = '' + this.form.OrgType = '' + this.form.UserName = '' + this.getTaskBackGroundGetJobs() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.$nextTick(() => { + this.dialogForm.TaskName = row.TaskName + this.dialogForm.GroupName = row.GroupName + this.dialogForm.Interval = row.Interval + this.dialogForm.ApiUrl = row.ApiUrl + this.dialogForm.AuthKey = row.AuthKey + this.dialogForm.AuthValue = row.AuthValue + this.dialogForm.Describe = row.Describe + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + TaskBackGroundRemove(row).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getTaskBackGroundGetJobs() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 鏆傚仠浠诲姟 + async pauseTask(row) { + const res = await TaskBackGroundPause(row) + if (res.code === '200') { + await this.getTaskBackGroundGetJobs() + return this.$message.success(res.message) + } + }, + // 寮�鍚换鍔� + async startTask(row) { + const res = await TaskBackGroundStart(row) + if (res.code === '200') { + await this.getTaskBackGroundGetJobs() + return this.$message.success(res.message) + } + }, + // 绔嬪嵆鎵ц + async runTask(row) { + const res = await TaskBackGroundRun(row) + if (res.code === '200') { + await this.getTaskBackGroundGetJobs() + this.$message.success(res.message) + } + }, + // 鏌ョ湅璁板綍 + async check(row) { + const data = { + TaskName: row.TaskName, + GroupName: row.GroupName, + page: 1 + } + const res = await TaskBackGroundGetRunLog(data) + + if (res.code === '200') { + this.recordData = res.data + this.dialogVisible2 = true + } + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.TaskName = '' + this.dialogForm.GroupName = '' + this.dialogForm.Interval = '' + this.dialogForm.ApiUrl = '' + this.dialogForm.AuthKey = '' + this.dialogForm.AuthValue = '' + this.dialogForm.Describe = '' + this.dialogForm.RequestType = 'POST' + this.dialogForm.LastRunTime = '' + this.dialogForm.Status = 0 + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + console.log(this.dialogForm) + + // console.log(new Date().getUTCDate()) + + this.$refs.dialogForm.validate(valid => { + if (valid) { + // const data = { + // OrganCode: this.dialogForm.OrgCode, + // OrganName: this.dialogForm.OrgName, + // OperType: this.operation === 'add' ? 'Add' : 'Update', + // Operator: getCookie('admin') + // } + + if (this.operation === 'add') { + TaskBackGroundAdd(this.dialogForm).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getTaskBackGroundGetJobs() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } else { + TaskBackGroundUpdate(this.dialogForm).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getTaskBackGroundGetJobs() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + } + }) + }, + handleClose2() { + this.recordData = [] + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style lang="scss" scoped> +::v-deep .pop_btn { + display: flex; + justify-content: right; +} +</style> diff --git a/src/views/basicSettings/groupList.vue b/src/views/basicSettings/groupList.vue index 8d151b7..bd842c7 100644 --- a/src/views/basicSettings/groupList.vue +++ b/src/views/basicSettings/groupList.vue @@ -1,358 +1,363 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=2')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鐝粍缂栫爜" style=" display: flex;"> - <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐝粍鍚嶇О" style=" display: flex;"> - <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getGroupData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="120" - fixed - label="搴忓彿" - /> - <el-table-column - prop="usergroupcode" - label="鐝粍缂栫爜" - sortable="custom" - /> - <el-table-column - prop="usergroupname" - label="鐝粍鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="status" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - prop="description" - label="鎻忚堪" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description?row.description:'/' }} - </template> - </el-table-column> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getGroupData" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="鐝粍缂栫爜" prop="groupcode"> - <el-input v-model="dialogForm.groupcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐝粍鍚嶇О" prop="groupname"> - <el-input v-model="dialogForm.groupname" style="width: 200px" /> - </el-form-item> - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.status" style="width: 200px"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="鎻忚堪"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateGroup, - DeleteGroup, - GroupData -} from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' - -export default { - name: 'GroupList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - groupcode: '', - groupname: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - groupcode: '', // - groupname: '', // - description: '', - status: 'Y'// 鐘舵�� - }, - operation: '', - dialogFormRules: { - groupcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - groupname: [ - { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getGroupData() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getGroupData() { - const res = await GroupData(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getGroupData() - }, - // 閲嶇疆 - reset() { - this.form.storg_code = '' - this.form.storg_name = '' - this.getGroupData() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - this.$nextTick(() => { - this.dialogForm.groupcode = row.usergroupcode - this.dialogForm.groupname = row.usergroupname - this.dialogForm.status = row.status - this.dialogForm.description = row.description - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteGroup({ groupcode: row.usergroupcode }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getGroupData() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.groupcode = '' - this.dialogForm.groupname = '' - this.dialogForm.description = '' - this.dialogForm.status = 'Y' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - AddUpdateGroup(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getGroupData() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=2')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鐝粍缂栫爜" style=" display: flex;"> + <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐝粍鍚嶇О" style=" display: flex;"> + <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getGroupData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="120" + fixed + label="搴忓彿" + /> + <el-table-column + prop="usergroupcode" + label="鐝粍缂栫爜" + sortable="custom" + /> + <el-table-column + prop="usergroupname" + label="鐝粍鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="status" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + prop="description" + label="鎻忚堪" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description?row.description:'/' }} + </template> + </el-table-column> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getGroupData" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="鐝粍缂栫爜" prop="groupcode"> + <el-input v-model="dialogForm.groupcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐝粍鍚嶇О" prop="groupname"> + <el-input v-model="dialogForm.groupname" style="width: 200px" /> + </el-form-item> + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.status" style="width: 200px"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateGroup, + DeleteGroup, + GroupData +} from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' + +export default { + name: 'GroupList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + groupcode: '', + groupname: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + groupcode: '', // + groupname: '', // + description: '', + status: 'Y'// 鐘舵�� + }, + operation: '', + dialogFormRules: { + groupcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + groupname: [ + { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getGroupData() + }, + created() { + this.getGroupData() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getGroupData() { + const res = await GroupData(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getGroupData() + }, + // 閲嶇疆 + reset() { + this.form.storg_code = '' + this.form.storg_name = '' + this.getGroupData() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + this.$nextTick(() => { + this.dialogForm.groupcode = row.usergroupcode + this.dialogForm.groupname = row.usergroupname + this.dialogForm.status = row.status + this.dialogForm.description = row.description + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteGroup({ groupcode: row.usergroupcode }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getGroupData() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.groupcode = '' + this.dialogForm.groupname = '' + this.dialogForm.description = '' + this.dialogForm.status = 'Y' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + AddUpdateGroup(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getGroupData() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/installLampList.vue b/src/views/basicSettings/installLampList.vue index 40ec4e7..b230cdb 100644 --- a/src/views/basicSettings/installLampList.vue +++ b/src/views/basicSettings/installLampList.vue @@ -1,598 +1,603 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="body_left"> - <div style="margin:10px 0"> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 杞﹂棿淇℃伅锛� - </div> - <el-input - v-model="filterText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - style="margin-bottom: 20px" - /> - <el-tree - ref="tree" - class="filter-tree body_left_tree" - :data="shopTree" - :props="defaultProps" - highlight-current - node-key="torg_code" - default-expand-all - :style="{height: contentHeight+'px',overflowY:'auto'}" - :filter-node-method="filterNode" - @current-change="currentTreeChange" - /> - </div> - <div class="body_right"> - <el-tabs ref="elTabs" type="border-card" @tab-click="tabClick"> - <el-tab-pane v-for="item in AnDengTypeArr" :key="item.id" :label="item.name"> - <div :style="{height: (contentHeight+51)+'px'}"> - <div class="pane_top"> - <div style="display: flex;align-items: center"> - <div class="bar" :style="{background:$store.state.settings.theme}" /> - <div>鍝嶅簲浜哄憳</div> - - <!-- <i class="el-icon-circle-plus-outline" />--> - <el-button - v-waves - icon="el-icon-circle-plus-outline" - :disabled="allowClose" - :style="{color:allowClose?'#6f6e6f':$store.state.settings.theme}" - style="height: 30px;line-height: 30px;font-size: 22px;padding:10px;margin-left: 10px;" - @click="responseUserClick" - /> - </div> - <div style="display: flex;align-content: center"> - <div> - <el-checkbox v-model="allowClose" @change="allowCloseChange">鍏佽鍏抽棴</el-checkbox> - </div> - <div style="margin-left: 5px;cursor: pointer"> - <el-tooltip class="item" effect="dark" content="褰撳墠鍛煎彨绫诲瀷(鍚敤/鍏抽棴)" placement="top"> - <i class="el-icon-question" :style="{color:$store.state.settings.theme}" /> - </el-tooltip> - </div> - </div> - </div> - <el-empty v-if="AnDengResponUserArr.length===0" :image-size="200" description="鏆傛棤鏁版嵁" /> - <div v-else class="pane_content" :style="{maxHeight:contentHeight+'px',overflowY: 'scroll'}"> - <el-tag - v-for="tag in AnDengResponUserArr" - :key="tag.id" - :closable="!allowClose" - type="success" - style="margin-right: 10px;margin-bottom: 10px" - :style="{color:$store.state.settings.theme}" - @close="val=>tagClose(val,item,tag)" - > - {{ tag.username }} - </el-tag> - - </div> - </div> - </el-tab-pane> - </el-tabs> - <el-button - - style="position: absolute;top: 13px;right:15px;z-index: 1000" - icon="el-icon-setting" - @click="setting" - >鑷畾涔夊懠鍙被鍨� - </el-button> - </div> - </div> - - <!-- 鑷畾涔夊懠鍙被鍨�--> - <el-dialog - v-el-drag-dialog - title="鑷畾涔夊懠鍙被鍨�" - :visible.sync="settingDialogVisible" - width="800px" - top="15vh" - :close-on-click-modal="false" - @closed="handleClose" - @close="handleClose" - > - <el-button - v-waves - type="primary" - style="margin-bottom: 10px;" - icon="el-icon-circle-plus-outline" - @click="addRow()" - >鏂板 - </el-button> - <el-table - ref="dialogTableDataArrRef" - class="tableFixed" - :data="settingDialogTableData" - :height="contentHeight-300" - :style="{width: 100+'%',height:contentHeight-300+'px',}" - border - :row-class-name="tableRowClassName" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - width="50" - label="搴忓彿" - type="index" - fixed - /> - - <el-table-column - prop="code" - label="绫诲瀷缂栫爜" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.code" - oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')" - placeholder="璇疯緭鍏�" - /> - <div v-if="row.isVisible===0">{{ row.code }}</div> - </template> - </el-table-column> - <el-table-column - prop="name" - label="绫诲瀷鍚嶇О" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.name" - placeholder="璇疯緭鍏�" - /> - <div v-if="row.isVisible===0">{{ row.name }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">淇濆瓨</el-button> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> - <!-- <el-button v-waves v-if="row.isVisible===0" type="text" @click="editRow(row)">缂栬緫</el-button>--> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> - </div> - </template> - </el-table-column> - </el-table> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="鍝嶅簲浜哄憳" - :visible.sync="userDialogVisible" - width="800px" - top="10vh" - :close-on-click-modal="false" - @closed="handleUserClose" - @close="handleUserClose" - > - <div - style=" background-color: #fafafa; padding: 10px; min-height: 120px;" - :style="{maxHeight:(contentHeight-300)+'px',overflowY: 'scroll'}" - > - <el-tag - v-for="tag in userDialogArr" - :key="tag.usercode" - closable - type="success" - style="margin-right: 10px;margin-bottom: 10px" - :style="{color:$store.state.settings.theme}" - @close="val=>userTagClose(val,tag)" - > - {{ tag.username }} - </el-tag> - </div> - <div> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin: 20px 10px 20px 0" />浜哄憳锛� - </div> - <div - style=" background-color: #fafafa; padding: 10px; min-height: 420px;" - :style="{maxHeight:(contentHeight-300)+'px'}" - > - - <el-input - v-model="filterUserText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - style="margin-bottom: 20px; " - /> - <el-tree - ref="userTree" - class="filter-tree" - :data="userTree" - :props="userDefaultProps" - node-key="usercode" - show-checkbox - default-expand-all - :style="{height: (contentHeight-370)+'px',overflowY:'auto'}" - :filter-node-method="filterUserNode" - @check="userTreeCheck" - /> - <!-- @check-change="handleCheckChange"--> - - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleUserCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleUserConfirm" - >淇� 瀛�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> - -import { - AddUpdateAnDengType, AnDengDigoResponUserSearch, AnDengDigoResponUserSeave, AnDengResponUserCloseSeave, - AnDengResponUserDeleteSeave, - AnDengResponUserSearch, - AnDengTypeSearch, - DeleteAnDengType -} from '@/api/basicSettings' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { PrentOrganization } from '@/api/GeneralBasicData' - -export default { - name: 'InstallLampList', - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - contentHeight: 0, - filterText: '', - shopTree: [], // 鏍戝舰杞﹂棿 - defaultProps: { - children: 'children', - label: 'torg_name' - }, - settingDialogVisible: false, - settingDialogTableData: [], - allowClose: false, // 鍏佽鍏抽棴 - AnDengTypeArr: [], // 瀹夌伅绫诲瀷 - AnDengResponUserArr: [], // 瀹夌伅鐢ㄦ埛 - userDialogVisible: false, - userDefaultProps: { - children: 'children', - label: 'username' - }, - userDialogArr: [], - userTree: [], - filterUserText: '', - treeCheckedKey: []// 鏍戝舰澶嶉�夋閫変腑鐨剈sercode - - } - }, - watch: { - filterText(val) { - this.$refs.tree.filter(val) - }, - filterUserText(val) { - this.$refs.userTree.filter(val) - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - handleRequest() { - this.getShopSearch().then(res => { - if (res.code === '200') { - this.getAnDengTypeSearch() - } - }) - }, - // 鑾峰彇宸︿晶杞﹂棿淇℃伅 - async getShopSearch() { - const res = await PrentOrganization() - this.shopTree = res.data - this.$nextTick(() => { - this.$refs.tree.setCurrentKey(this.shopTree[0].torg_code) // 榛樿閫変腑鑺傜偣绗竴涓� - }) - return { code: res.code } - }, - // 鑾峰彇瀹夌伅绫诲瀷 - async getAnDengTypeSearch() { - const { data: res } = await AnDengTypeSearch() - this.AnDengTypeArr = res - await this.getAnDengResponUserSearch(this.AnDengTypeArr[0].name) - }, - // 鑾峰彇瀹夌伅浜哄憳 - async getAnDengResponUserSearch(name) { - const data = { - wkshopcode: this.$refs.tree.getCurrentKey(), - calltypecode: this.AnDengTypeArr.find(item => item.name === name).code - } - const { data: res } = await AnDengResponUserSearch(data) - this.AnDengResponUserArr = res || [] - - this.allowClose = this.AnDengResponUserArr[0] ? this.AnDengResponUserArr[0].enable === 'Y' : false - }, - // tab鍒囨崲鐐瑰嚮 - tabClick(val) { - this.getAnDengResponUserSearch(val.label) - }, - // 瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎 - async tagClose(val, tab, tag) { - const data = { - ando_cogfigid: tab.id, - id: tag.id - } - const res = await AnDengResponUserDeleteSeave(data) - if (res.code === '200') { - await this.getAnDengResponUserSearch(tab.name) - } - }, - // 杩囨护鑺傜偣 - filterNode(value, data) { - if (!value) return true - return data.torg_name.indexOf(value) !== -1 - }, - // 鑷畾涔夊懠鍙被鍨� - async setting() { - const { data: res } = await AnDengTypeSearch() - this.settingDialogTableData = res - this.settingDialogVisible = true - - this.settingDialogTableData.forEach(item => { - let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� - number = number === 0 ? (10 + Math.random()) : number - item.number = number - item.isVisible = 0 - }) - }, - addRow() { - if (this.settingDialogTableData.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨鎴栧彇娑堟湰鏉¤褰曪紒') - } - let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� - number = number === 0 ? (10 + Math.random()) : number - this.settingDialogTableData.push({ - number, - isVisible: 1, - code: '', - name: '' - }) - }, - async saveRow(row) { - console.log(row) - if (row.code.toString().trim() === '' || row.name.toString().trim() === '') { - return this.$message.info('绫诲瀷缂栫爜鎴栧悕绉颁笉鑳戒负绌猴紒') - } - const res = await AddUpdateAnDengType([row]) - if (res.code === '200') { - await this.setting() - } - }, - cancelRow(row) { - this.settingDialogTableData.splice(this.settingDialogTableData.length - 1, 1) - }, - delRow(row) { - if (this.settingDialogTableData.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨鎴栧彇娑堟湰鏉¤褰曪紒') - } - DeleteAnDengType({ andengtypecode: row.code }).then(res => { - this.setting() - }) - }, - handleClose() { - this.settingDialogTableData = [] - }, - // 杩斿洖 - dialogVisibleCancel() { - this.settingDialogVisible = false - this.getAnDengTypeSearch() - }, - // 鍏佽鍏抽棴鐐瑰嚮浜嬩欢 - async allowCloseChange() { - const data = { - wkshopcode: this.$refs.tree.getCurrentKey(), - calltypecode: this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code, - enable: this.allowClose ? 'Y' : 'N' - } - await AnDengResponUserCloseSeave(data) - }, - // 鏍戝舰閫変腑琛屽垏鎹㈢偣鍑� - currentTreeChange(val) { - this.getAnDengResponUserSearch(this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].name) - }, - // 鍝嶅簲浜哄憳鐐瑰嚮 - responseUserClick() { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - - const data = { - wkshopcode: this.$refs.tree.getCurrentKey(), - calltypecode: this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code - } - AnDengDigoResponUserSearch(data).then(res => { - if (res.code === '200') { - this.userTree.push({ - username: '鍏ㄩ儴', - children: res.data - }) - - res.data.forEach(item => { - if (item.flag === 'Y') { - this.treeCheckedKey.push(item.usercode) - this.userDialogArr.push(item) - } - }) - - setTimeout(() => { - loading.close() - this.userDialogVisible = true - - this.$nextTick(() => { - this.$refs.userTree.setCheckedKeys(this.treeCheckedKey) - }) - }, 1000) - } - }) - }, - handleUserClose() { - this.userTree = [] - this.userDialogArr = [] - this.treeCheckedKey = [] - }, - dialogVisibleUserCancel() { - this.userDialogVisible = false - }, - async dialogVisibleUserConfirm() { - const data = [] - - this.$refs.userTree.getCheckedKeys().forEach(i => { - // console.log(i) - if (i !== undefined) { - data.push({ - code: i - }) - } - }) - this.$store.state.app.buttonIsDisabled = true - const res = await AnDengDigoResponUserSeave(this.$refs.tree.getCurrentKey(), this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code, this.allowClose ? 'Y' : 'N', data) - if (res.code === '200') { - // this.$refs.userTree.setCheckedKeys([]) - this.userDialogVisible = false - this.$message.success('淇濆瓨鎴愬姛锛�') - this.$store.state.app.buttonIsDisabled = false - await this.getAnDengResponUserSearch(this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].name) - } - }, - userTagClose(val, tag) { - this.treeCheckedKey = this.treeCheckedKey.filter(i => i !== tag.usercode) - this.userDialogArr = this.userDialogArr.filter(i => i.usercode !== tag.usercode) - this.$refs.userTree.setCheckedKeys(this.treeCheckedKey) - }, - userTreeCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { - // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, 6) - this.treeCheckedKey = checkedKeys.filter(i => i !== undefined) - this.userTree[0].children.forEach(i => { - if (this.treeCheckedKey.includes(i.usercode)) { - i.flag = 'Y' - } else { - i.flag = 'N' - } - }) - this.userDialogArr = this.userTree[0].children.filter(i => i.flag === 'Y') - }, - // handleCheckChange(data) { - // if (data.children) { - // data.children.forEach((item) => { - // const node = this.$refs.userTree.getNode(item) - // if (!node.visible) { - // this.$refs.userTree.setChecked(item, false) - // } - // }) - // } - // }, - // 杩囨护鑺傜偣 - filterUserNode(value, data) { - if (!value) return true - return data.username.indexOf(value) !== -1 - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.contentHeight = this.mainHeight - 142 - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - - } -} -</script> - -<!--鏈〉闈㈠崟鐙牱寮�--> -<style lang="scss" scoped> -$main_color: #42b983; -.body { - display: flex; - flex-direction: row; -} - -.body_left { - width: 360px; - background-color: #fff; - margin: 10px 0; - padding: 10px; - flex-direction: column; -} - -.body_right { - width: 100%; - background-color: #fff; - margin: 10px 0 10px 10px; -} - -.pane_top { - background-color: #fafafa; - height: 50px; - display: flex; - align-items: center; - justify-content: space-between; - padding: 0 10px; - margin-bottom: 20px; - - .bar { - width: 4px; - height: 20px; - border-radius: 2px; - //background-color: $main_color; - margin-right: 10px; - } -} - -.pane_content { - background-color: #fafafa; - padding: 10px; - min-height: 400px; -} - -.body_left_tree { - ::v-deep .is-current > .el-tree-node__content { - background-color: #dedcdc !important; - font-weight: bolder; - //color: #FFFFFF; - } -} - -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="body_left"> + <div style="margin:10px 0"> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 杞﹂棿淇℃伅锛� + </div> + <el-input + v-model="filterText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + style="margin-bottom: 20px" + /> + <el-tree + ref="tree" + class="filter-tree body_left_tree" + :data="shopTree" + :props="defaultProps" + highlight-current + node-key="torg_code" + default-expand-all + :style="{height: contentHeight+'px',overflowY:'auto'}" + :filter-node-method="filterNode" + @current-change="currentTreeChange" + /> + </div> + <div class="body_right"> + <el-tabs ref="elTabs" type="border-card" @tab-click="tabClick"> + <el-tab-pane v-for="item in AnDengTypeArr" :key="item.id" :label="item.name"> + <div :style="{height: (contentHeight+51)+'px'}"> + <div class="pane_top"> + <div style="display: flex;align-items: center"> + <div class="bar" :style="{background:$store.state.settings.theme}" /> + <div>鍝嶅簲浜哄憳</div> + + <!-- <i class="el-icon-circle-plus-outline" />--> + <el-button + v-waves + icon="el-icon-circle-plus-outline" + :disabled="allowClose" + :style="{color:allowClose?'#6f6e6f':$store.state.settings.theme}" + style="height: 30px;line-height: 30px;font-size: 22px;padding:10px;margin-left: 10px;" + @click="responseUserClick" + /> + </div> + <div style="display: flex;align-content: center"> + <div> + <el-checkbox v-model="allowClose" @change="allowCloseChange">鍏佽鍏抽棴</el-checkbox> + </div> + <div style="margin-left: 5px;cursor: pointer"> + <el-tooltip class="item" effect="dark" content="褰撳墠鍛煎彨绫诲瀷(鍚敤/鍏抽棴)" placement="top"> + <i class="el-icon-question" :style="{color:$store.state.settings.theme}" /> + </el-tooltip> + </div> + </div> + </div> + <el-empty v-if="AnDengResponUserArr.length===0" :image-size="200" description="鏆傛棤鏁版嵁" /> + <div v-else class="pane_content" :style="{maxHeight:contentHeight+'px',overflowY: 'scroll'}"> + <el-tag + v-for="tag in AnDengResponUserArr" + :key="tag.id" + :closable="!allowClose" + type="success" + style="margin-right: 10px;margin-bottom: 10px" + :style="{color:$store.state.settings.theme}" + @close="val=>tagClose(val,item,tag)" + > + {{ tag.username }} + </el-tag> + + </div> + </div> + </el-tab-pane> + </el-tabs> + <el-button + + style="position: absolute;top: 13px;right:15px;z-index: 1000" + icon="el-icon-setting" + @click="setting" + >鑷畾涔夊懠鍙被鍨� + </el-button> + </div> + </div> + + <!-- 鑷畾涔夊懠鍙被鍨�--> + <el-dialog + v-el-drag-dialog + title="鑷畾涔夊懠鍙被鍨�" + :visible.sync="settingDialogVisible" + width="800px" + top="15vh" + :close-on-click-modal="false" + @closed="handleClose" + @close="handleClose" + > + <el-button + v-waves + type="primary" + style="margin-bottom: 10px;" + icon="el-icon-circle-plus-outline" + @click="addRow()" + >鏂板 + </el-button> + <el-table + ref="dialogTableDataArrRef" + class="tableFixed" + :data="settingDialogTableData" + :height="contentHeight-300" + :style="{width: 100+'%',height:contentHeight-300+'px',}" + border + :row-class-name="tableRowClassName" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + width="50" + label="搴忓彿" + type="index" + fixed + /> + + <el-table-column + prop="code" + label="绫诲瀷缂栫爜" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.code" + oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')" + placeholder="璇疯緭鍏�" + /> + <div v-if="row.isVisible===0">{{ row.code }}</div> + </template> + </el-table-column> + <el-table-column + prop="name" + label="绫诲瀷鍚嶇О" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.name" + placeholder="璇疯緭鍏�" + /> + <div v-if="row.isVisible===0">{{ row.name }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">淇濆瓨</el-button> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> + <!-- <el-button v-waves v-if="row.isVisible===0" type="text" @click="editRow(row)">缂栬緫</el-button>--> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> + </div> + </template> + </el-table-column> + </el-table> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="鍝嶅簲浜哄憳" + :visible.sync="userDialogVisible" + width="800px" + top="10vh" + :close-on-click-modal="false" + @closed="handleUserClose" + @close="handleUserClose" + > + <div + style=" background-color: #fafafa; padding: 10px; min-height: 120px;" + :style="{maxHeight:(contentHeight-300)+'px',overflowY: 'scroll'}" + > + <el-tag + v-for="tag in userDialogArr" + :key="tag.usercode" + closable + type="success" + style="margin-right: 10px;margin-bottom: 10px" + :style="{color:$store.state.settings.theme}" + @close="val=>userTagClose(val,tag)" + > + {{ tag.username }} + </el-tag> + </div> + <div> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin: 20px 10px 20px 0" />浜哄憳锛� + </div> + <div + style=" background-color: #fafafa; padding: 10px; min-height: 420px;" + :style="{maxHeight:(contentHeight-300)+'px'}" + > + + <el-input + v-model="filterUserText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + style="margin-bottom: 20px; " + /> + <el-tree + ref="userTree" + class="filter-tree" + :data="userTree" + :props="userDefaultProps" + node-key="usercode" + show-checkbox + default-expand-all + :style="{height: (contentHeight-370)+'px',overflowY:'auto'}" + :filter-node-method="filterUserNode" + @check="userTreeCheck" + /> + <!-- @check-change="handleCheckChange"--> + + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleUserCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleUserConfirm" + >淇� 瀛�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> + +import { + AddUpdateAnDengType, AnDengDigoResponUserSearch, AnDengDigoResponUserSeave, AnDengResponUserCloseSeave, + AnDengResponUserDeleteSeave, + AnDengResponUserSearch, + AnDengTypeSearch, + DeleteAnDengType +} from '@/api/basicSettings' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { PrentOrganization } from '@/api/GeneralBasicData' + +export default { + name: 'InstallLampList', + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + contentHeight: 0, + filterText: '', + shopTree: [], // 鏍戝舰杞﹂棿 + defaultProps: { + children: 'children', + label: 'torg_name' + }, + settingDialogVisible: false, + settingDialogTableData: [], + allowClose: false, // 鍏佽鍏抽棴 + AnDengTypeArr: [], // 瀹夌伅绫诲瀷 + AnDengResponUserArr: [], // 瀹夌伅鐢ㄦ埛 + userDialogVisible: false, + userDefaultProps: { + children: 'children', + label: 'username' + }, + userDialogArr: [], + userTree: [], + filterUserText: '', + treeCheckedKey: []// 鏍戝舰澶嶉�夋閫変腑鐨剈sercode + + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + }, + filterUserText(val) { + this.$refs.userTree.filter(val) + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + handleRequest() { + this.getShopSearch().then(res => { + if (res.code === '200') { + this.getAnDengTypeSearch() + } + }) + }, + // 鑾峰彇宸︿晶杞﹂棿淇℃伅 + async getShopSearch() { + const res = await PrentOrganization() + this.shopTree = res.data + this.$nextTick(() => { + this.$refs.tree.setCurrentKey(this.shopTree[0].torg_code) // 榛樿閫変腑鑺傜偣绗竴涓� + }) + return { code: res.code } + }, + // 鑾峰彇瀹夌伅绫诲瀷 + async getAnDengTypeSearch() { + const { data: res } = await AnDengTypeSearch() + this.AnDengTypeArr = res + await this.getAnDengResponUserSearch(this.AnDengTypeArr[0].name) + }, + // 鑾峰彇瀹夌伅浜哄憳 + async getAnDengResponUserSearch(name) { + const data = { + wkshopcode: this.$refs.tree.getCurrentKey(), + calltypecode: this.AnDengTypeArr.find(item => item.name === name).code + } + const { data: res } = await AnDengResponUserSearch(data) + this.AnDengResponUserArr = res || [] + + this.allowClose = this.AnDengResponUserArr[0] ? this.AnDengResponUserArr[0].enable === 'Y' : false + }, + // tab鍒囨崲鐐瑰嚮 + tabClick(val) { + this.getAnDengResponUserSearch(val.label) + }, + // 瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎 + async tagClose(val, tab, tag) { + const data = { + ando_cogfigid: tab.id, + id: tag.id + } + const res = await AnDengResponUserDeleteSeave(data) + if (res.code === '200') { + await this.getAnDengResponUserSearch(tab.name) + } + }, + // 杩囨护鑺傜偣 + filterNode(value, data) { + if (!value) return true + return data.torg_name.indexOf(value) !== -1 + }, + // 鑷畾涔夊懠鍙被鍨� + async setting() { + const { data: res } = await AnDengTypeSearch() + this.settingDialogTableData = res + this.settingDialogVisible = true + + this.settingDialogTableData.forEach(item => { + let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� + number = number === 0 ? (10 + Math.random()) : number + item.number = number + item.isVisible = 0 + }) + }, + addRow() { + if (this.settingDialogTableData.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨鎴栧彇娑堟湰鏉¤褰曪紒') + } + let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� + number = number === 0 ? (10 + Math.random()) : number + this.settingDialogTableData.push({ + number, + isVisible: 1, + code: '', + name: '' + }) + }, + async saveRow(row) { + console.log(row) + if (row.code.toString().trim() === '' || row.name.toString().trim() === '') { + return this.$message.info('绫诲瀷缂栫爜鎴栧悕绉颁笉鑳戒负绌猴紒') + } + const res = await AddUpdateAnDengType([row]) + if (res.code === '200') { + await this.setting() + } + }, + cancelRow(row) { + this.settingDialogTableData.splice(this.settingDialogTableData.length - 1, 1) + }, + delRow(row) { + if (this.settingDialogTableData.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨鎴栧彇娑堟湰鏉¤褰曪紒') + } + DeleteAnDengType({ andengtypecode: row.code }).then(res => { + this.setting() + }) + }, + handleClose() { + this.settingDialogTableData = [] + }, + // 杩斿洖 + dialogVisibleCancel() { + this.settingDialogVisible = false + this.getAnDengTypeSearch() + }, + // 鍏佽鍏抽棴鐐瑰嚮浜嬩欢 + async allowCloseChange() { + const data = { + wkshopcode: this.$refs.tree.getCurrentKey(), + calltypecode: this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code, + enable: this.allowClose ? 'Y' : 'N' + } + await AnDengResponUserCloseSeave(data) + }, + // 鏍戝舰閫変腑琛屽垏鎹㈢偣鍑� + currentTreeChange(val) { + this.getAnDengResponUserSearch(this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].name) + }, + // 鍝嶅簲浜哄憳鐐瑰嚮 + responseUserClick() { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + + const data = { + wkshopcode: this.$refs.tree.getCurrentKey(), + calltypecode: this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code + } + AnDengDigoResponUserSearch(data).then(res => { + if (res.code === '200') { + this.userTree.push({ + username: '鍏ㄩ儴', + children: res.data + }) + + res.data.forEach(item => { + if (item.flag === 'Y') { + this.treeCheckedKey.push(item.usercode) + this.userDialogArr.push(item) + } + }) + + setTimeout(() => { + loading.close() + this.userDialogVisible = true + + this.$nextTick(() => { + this.$refs.userTree.setCheckedKeys(this.treeCheckedKey) + }) + }, 1000) + } + }) + }, + handleUserClose() { + this.userTree = [] + this.userDialogArr = [] + this.treeCheckedKey = [] + }, + dialogVisibleUserCancel() { + this.userDialogVisible = false + }, + async dialogVisibleUserConfirm() { + const data = [] + + this.$refs.userTree.getCheckedKeys().forEach(i => { + // console.log(i) + if (i !== undefined) { + data.push({ + code: i + }) + } + }) + this.$store.state.app.buttonIsDisabled = true + const res = await AnDengDigoResponUserSeave(this.$refs.tree.getCurrentKey(), this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].code, this.allowClose ? 'Y' : 'N', data) + if (res.code === '200') { + // this.$refs.userTree.setCheckedKeys([]) + this.userDialogVisible = false + this.$message.success('淇濆瓨鎴愬姛锛�') + this.$store.state.app.buttonIsDisabled = false + await this.getAnDengResponUserSearch(this.AnDengTypeArr[parseInt(this.$refs.elTabs.currentName)].name) + } + }, + userTagClose(val, tag) { + this.treeCheckedKey = this.treeCheckedKey.filter(i => i !== tag.usercode) + this.userDialogArr = this.userDialogArr.filter(i => i.usercode !== tag.usercode) + this.$refs.userTree.setCheckedKeys(this.treeCheckedKey) + }, + userTreeCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { + // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, 6) + this.treeCheckedKey = checkedKeys.filter(i => i !== undefined) + this.userTree[0].children.forEach(i => { + if (this.treeCheckedKey.includes(i.usercode)) { + i.flag = 'Y' + } else { + i.flag = 'N' + } + }) + this.userDialogArr = this.userTree[0].children.filter(i => i.flag === 'Y') + }, + // handleCheckChange(data) { + // if (data.children) { + // data.children.forEach((item) => { + // const node = this.$refs.userTree.getNode(item) + // if (!node.visible) { + // this.$refs.userTree.setChecked(item, false) + // } + // }) + // } + // }, + // 杩囨护鑺傜偣 + filterUserNode(value, data) { + if (!value) return true + return data.username.indexOf(value) !== -1 + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.contentHeight = this.mainHeight - 142 + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + + } +} +</script> + +<!--鏈〉闈㈠崟鐙牱寮�--> +<style lang="scss" scoped> +$main_color: #42b983; +.body { + display: flex; + flex-direction: row; +} + +.body_left { + width: 360px; + background-color: #fff; + margin: 10px 0; + padding: 10px; + flex-direction: column; +} + +.body_right { + width: 100%; + background-color: #fff; + margin: 10px 0 10px 10px; +} + +.pane_top { + background-color: #fafafa; + height: 50px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 10px; + margin-bottom: 20px; + + .bar { + width: 4px; + height: 20px; + border-radius: 2px; + //background-color: $main_color; + margin-right: 10px; + } +} + +.pane_content { + background-color: #fafafa; + padding: 10px; + min-height: 400px; +} + +.body_left_tree { + ::v-deep .is-current > .el-tree-node__content { + background-color: #dedcdc !important; + font-weight: bolder; + //color: #FFFFFF; + } +} + +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} +</style> diff --git a/src/views/basicSettings/meterPrice.vue b/src/views/basicSettings/meterPrice.vue index c207fcc..1cbf6d9 100644 --- a/src/views/basicSettings/meterPrice.vue +++ b/src/views/basicSettings/meterPrice.vue @@ -1,707 +1,712 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <!-- <el-button v-waves icon="el-icon-download" @click=" ">瀵煎叆</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="浜у搧鍚嶇О/缂栫爜" style=" display: flex;"> - <el-select - v-model="form.partcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - - @change="partChange" - > - <!-- @focus="getPartSelect"--> - <el-option - v-for="item in partArr" - :key="item.partcode" - :label="item.partname+'/'+item.partcode" - :value="item.partcode" - /> - </el-select> - </el-form-item> - <el-form-item - v-if="mesSetting.route" - label="宸ヨ壓璺嚎" - style="display: flex;" - > - <el-select - v-model="form.routecode" - filterable - :disabled="form.partcode===''" - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - @change="routeChange" - > - <el-option - v-for="item in routeArr" - :key="item.route_code" - :label="item.route_name" - :value="item.route_code" - /> - </el-select> - </el-form-item> - <el-form-item label="鍏宠仈宸ュ簭" style=" display: flex;"> - <el-select - v-model="form.stepcode" - :disabled="mesSetting.route?form.routecode==='':form.partcode===''" - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in stepArr" - :key="item.step_code" - :label="item.step_name" - :value="item.step_code" - /> - </el-select> - </el-form-item> - - <!--鎸夊伐搴�--> - <!-- <el-form-item--> - <!-- v-if="!mesSetting.route"--> - <!-- label="宸ヨ壓璺嚎"--> - <!-- style="display: flex;"--> - <!-- >--> - <!-- <el-select--> - <!-- v-model="form.routecode"--> - <!-- filterable--> - <!-- :disabled="form.partcode===''"--> - <!-- :popper-append-to-body="false"--> - <!-- style="width: 200px"--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- @change="routeChange"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in routeArr"--> - <!-- :key="item.route_code"--> - <!-- :label="item.route_name"--> - <!-- :value="item.route_code"--> - <!-- />--> - <!-- </el-select>--> - <!-- </el-form-item>--> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampArrayKey" - class="tableFixed" - :data="tableData" - :height="tableHeight" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='eqp_value'||item.prop==='stand_value'"> - {{ row[item.prop] }} 绉� - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - :style="{color:$store.state.settings.theme}" - class="el-icon-edit-outline" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getBeatRateSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="1100px" - top="15vh" - :close-on-click-modal="false" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :model="dialogForm" label-width="100px"> - <div style="display: flex;align-items: center"> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" /> - <el-form-item prop="partcode" label="浜у搧鍚嶇О/缂栫爜"> - <el-select - v-show="operation==='add'" - v-model="dialogForm.partcode" - filterable - style="width: 220px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - @change="partDialogChange" - > - <!-- @focus="getPartSelect2"--> - <el-option - v-for="item in partArr2" - :key="item.partcode" - :label="item.partname+'/'+item.partcode" - :value="item.partcode" - /> - </el-select> - <el-input - v-show="operation!=='add'" - v-model="editPartName" - disabled - style="width: 220px" - /> - </el-form-item> - <el-form-item v-if="mesSetting.route" prop="routecode" label="宸ヨ壓璺嚎"> - <el-select - v-show="operation==='add'" - v-model="dialogForm.routecode" - style="width: 220px" - filterable - :disabled="dialogForm.partcode===''" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - @change="routeDialogChange" - > - <el-option - v-for="item in routeDialogArr" - :key="item.route_code" - :label="item.route_name" - :value="item.route_code" - /> - </el-select> - <el-input - v-show="operation!=='add'" - v-model="editRouteName" - disabled - style="width: 220px" - /> - </el-form-item> - </div> - </el-form> - - <el-table - :data="stepDialogArr" - style="width: 100%" - height="300" - border - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - :row-class-name="tableRowClassName" - > - <el-table-column - prop="step_seq" - label="宸ュ簭椤哄簭" - width="100" - /> - <el-table-column - prop="step_code" - label="宸ュ簭缂栫爜" - width="200" - /> - <el-table-column - prop="step_name" - label="宸ュ簭鍚嶇О" - width="200" - /> - <el-table-column - prop="unprice" - label="宸ュ簭宸ヤ环" - > - <template slot-scope="{row}"> - <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" /> - </template> - </el-table-column> - </el-table> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - BeatRateSearch, DeleteBeatRate, - PartSelect, - PartSelectRpute, - RouteSelectStep, SaveBeatRate -} from '@/api/basicSettings' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'MeterPrice', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mesSetting: JSON.parse(localStorage.getItem('mesSetting')), - mainHeight: 0, - tableHeight: 0, - form: { - partcode: '', // 浜у搧缂栫爜 - routecode: '', // 宸ヨ壓璺嚎缂栫爜 - stepcode: '', // 宸ュ簭缂栫爜 - - prop: 'partcode', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - partArr: [], // 浜у搧闆嗗悎 - partArr2: [], // 浜у搧闆嗗悎瀵硅瘽妗� - routeArr: [], // 宸ヨ壓璺嚎 - stepArr: [], // 宸ュ簭 - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'partcode', - label: '浜у搧缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'partname', - label: '浜у搧鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'partspec', - label: '浜у搧瑙勬牸', - id: 5, - show: true, - fixed: false, - sortable: true - }, - // { - // minWidth: 110, - // width: false, - // prop: 'wksp_code', - // label: '鐢熶骇杞﹂棿缂栫爜', - // id: 6, - // show: false, - // fixed: false, - // sortable: true - // }, - // { - // minWidth: false, - // width: 110, - // prop: 'wksp_name', - // label: '鐢熶骇杞﹂棿', - // id: 7, - // show: true, - // fixed: false, - // sortable: true - // }, - { - minWidth: 110, - width: false, - prop: 'route_code', - label: '宸ヨ壓璺嚎缂栫爜', - id: 8, - show: false, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'route_name', - label: '宸ヨ壓璺嚎', - id: 9, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'stepcode', - label: '宸ュ簭缂栫爜', - id: 10, - show: false, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'stepname', - label: '宸ュ簭鍚嶇О', - id: 11, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'unprice', - label: '璁′欢鍗曚环', - id: 12, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 13, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 14, - show: true, - fixed: false, - sortable: true - } - - ], - tableTimeStampArrayKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - dialogForm: { - partcode: '', // 浜у搧缂栫爜 - routecode: '', // 宸ヨ壓璺嚎缂栫爜 - stepcode: '', // 宸ュ簭缂栫爜 - - wkshopcode: '', // 鐢熶骇杞﹂棿缂栫爜 - eqp_value: '', // 璁惧鑺傛媿 - stand_value: '', // 鐢熶骇鑺傛媿 - cavity_qty: '', // 鍨嬭厰鏁� - unprice: ''// 璁′欢鍗曚环 - }, - routeDialogArr: [], // 宸ヨ壓璺嚎 - stepDialogArr: [], // 宸ュ簭闆嗗悎 - - editPartName: '', // 缂栬緫鏃朵骇鍝佸悕绉� - editRouteName: '', // 缂栬緫鏃跺伐鑹鸿矾绾垮悕绉� - editStepName: '', // 缂栬緫鏃跺姞宸ュ伐搴忓悕绉� - operation: '' - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - if (!this.mesSetting.route) { - this.tableColumnSettingsArray = this.tableColumnSettingsArray.filter(i => i.prop !== 'route_name') - } - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampArrayKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - handleRequest() { - this.getBeatRateSearch().then(res => { - if (res.code === '200') { - this.getPartSelect() - } - }) - }, - - async getBeatRateSearch() { - const res = await BeatRateSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getBeatRateSearch() - }, - // 鏌ヨ - search() { - this.getBeatRateSearch() - }, - async getPartSelect() { - const { data: res } = await PartSelect() - this.partArr = res - }, - async getPartSelect2() { - const { data: res } = await PartSelect() - this.partArr2 = res - }, - async partChange(val) { - const { data: res } = await PartSelectRpute({ partcode: val }) - if (this.mesSetting.route) { - this.routeArr = res - this.form.routecode = '' - } else { - this.stepArr = res - } - this.form.stepcode = '' - }, - async routeChange(val) { - const { data: res } = await RouteSelectStep({ partcode: this.form.partcode, routecode: val }) - this.stepArr = res - this.form.stepcode = '' - }, - - // 閲嶇疆 - reset() { - this.form.partcode = '' - this.form.routecode = '' - this.form.stepcode = '' - this.getBeatRateSearch() - }, - async partDialogChange(val) { - const { data: res } = await PartSelectRpute({ partcode: val }) - if (this.mesSetting.route) { - this.routeDialogArr = res - this.stepDialogArr = [] - this.dialogForm.routecode = '' - } else { - this.stepDialogArr = res - } - }, - async routeDialogChange(val) { - const { data: res } = await RouteSelectStep({ partcode: this.dialogForm.partcode, routecode: val }) - this.stepDialogArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.getPartSelect2() - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.editPartName = row.partname - this.editRouteName = row.route_name - this.editStepName = row.stepname - - await this.partDialogChange(row.partcode) - - this.dialogForm.partcode = row.partcode - if (this.mesSetting.route) { - await this.routeDialogChange(row.route_code) - } - this.dialogForm.routecode = row.route_code - this.dialogForm.stepcode = row.stepcode - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteBeatRate({ id: row.id }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getBeatRateSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.partcode = '' - this.dialogForm.routecode = '' - this.dialogForm.stepcode = '' - - this.dialogForm.wkshopcode = '' - this.dialogForm.eqp_value = '' - this.dialogForm.stand_value = '' - this.dialogForm.cavity_qty = '' - this.dialogForm.unprice = '' - this.eqpTableLength = 0 - this.routeDialogArr = [] - this.stepDialogArr = [] - - this.$refs.dialogForm.clearValidate() - this.getBeatRateSearch() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const children = [] - this.stepDialogArr.forEach(i => { - children.push({ - 'code': i.step_code, - 'name': i.step_name, - 'seq': i.step_seq, - 'isbott': i.isbott, - 'isend': i.isend, - 'unprice': i.unprice - }) - }) - - const data = [ - { - 'partcode': this.dialogForm.partcode, - 'defaultroute_code': this.dialogForm.routecode, - 'children': children - } - ] - SaveBeatRate(data).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getBeatRateSearch() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - if (window.innerHeight < 769) { - this.tableHeight = this.tableHeight - 40 - } - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> - -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <!-- <el-button v-waves icon="el-icon-download" @click=" ">瀵煎叆</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="浜у搧鍚嶇О/缂栫爜" style=" display: flex;"> + <el-select + v-model="form.partcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + + @change="partChange" + > + <!-- @focus="getPartSelect"--> + <el-option + v-for="item in partArr" + :key="item.partcode" + :label="item.partname+'/'+item.partcode" + :value="item.partcode" + /> + </el-select> + </el-form-item> + <el-form-item + v-if="mesSetting.route" + label="宸ヨ壓璺嚎" + style="display: flex;" + > + <el-select + v-model="form.routecode" + filterable + :disabled="form.partcode===''" + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + @change="routeChange" + > + <el-option + v-for="item in routeArr" + :key="item.route_code" + :label="item.route_name" + :value="item.route_code" + /> + </el-select> + </el-form-item> + <el-form-item label="鍏宠仈宸ュ簭" style=" display: flex;"> + <el-select + v-model="form.stepcode" + :disabled="mesSetting.route?form.routecode==='':form.partcode===''" + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in stepArr" + :key="item.step_code" + :label="item.step_name" + :value="item.step_code" + /> + </el-select> + </el-form-item> + + <!--鎸夊伐搴�--> + <!-- <el-form-item--> + <!-- v-if="!mesSetting.route"--> + <!-- label="宸ヨ壓璺嚎"--> + <!-- style="display: flex;"--> + <!-- >--> + <!-- <el-select--> + <!-- v-model="form.routecode"--> + <!-- filterable--> + <!-- :disabled="form.partcode===''"--> + <!-- :popper-append-to-body="false"--> + <!-- style="width: 200px"--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- @change="routeChange"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in routeArr"--> + <!-- :key="item.route_code"--> + <!-- :label="item.route_name"--> + <!-- :value="item.route_code"--> + <!-- />--> + <!-- </el-select>--> + <!-- </el-form-item>--> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampArrayKey" + class="tableFixed" + :data="tableData" + :height="tableHeight" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='eqp_value'||item.prop==='stand_value'"> + {{ row[item.prop] }} 绉� + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + :style="{color:$store.state.settings.theme}" + class="el-icon-edit-outline" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getBeatRateSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="1100px" + top="15vh" + :close-on-click-modal="false" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :model="dialogForm" label-width="100px"> + <div style="display: flex;align-items: center"> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" /> + <el-form-item prop="partcode" label="浜у搧鍚嶇О/缂栫爜"> + <el-select + v-show="operation==='add'" + v-model="dialogForm.partcode" + filterable + style="width: 220px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + @change="partDialogChange" + > + <!-- @focus="getPartSelect2"--> + <el-option + v-for="item in partArr2" + :key="item.partcode" + :label="item.partname+'/'+item.partcode" + :value="item.partcode" + /> + </el-select> + <el-input + v-show="operation!=='add'" + v-model="editPartName" + disabled + style="width: 220px" + /> + </el-form-item> + <el-form-item v-if="mesSetting.route" prop="routecode" label="宸ヨ壓璺嚎"> + <el-select + v-show="operation==='add'" + v-model="dialogForm.routecode" + style="width: 220px" + filterable + :disabled="dialogForm.partcode===''" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + @change="routeDialogChange" + > + <el-option + v-for="item in routeDialogArr" + :key="item.route_code" + :label="item.route_name" + :value="item.route_code" + /> + </el-select> + <el-input + v-show="operation!=='add'" + v-model="editRouteName" + disabled + style="width: 220px" + /> + </el-form-item> + </div> + </el-form> + + <el-table + :data="stepDialogArr" + style="width: 100%" + height="300" + border + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + :row-class-name="tableRowClassName" + > + <el-table-column + prop="step_seq" + label="宸ュ簭椤哄簭" + width="100" + /> + <el-table-column + prop="step_code" + label="宸ュ簭缂栫爜" + width="200" + /> + <el-table-column + prop="step_name" + label="宸ュ簭鍚嶇О" + width="200" + /> + <el-table-column + prop="unprice" + label="宸ュ簭宸ヤ环" + > + <template slot-scope="{row}"> + <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" /> + </template> + </el-table-column> + </el-table> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + BeatRateSearch, DeleteBeatRate, + PartSelect, + PartSelectRpute, + RouteSelectStep, SaveBeatRate +} from '@/api/basicSettings' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'MeterPrice', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mesSetting: JSON.parse(localStorage.getItem('mesSetting')), + mainHeight: 0, + tableHeight: 0, + form: { + partcode: '', // 浜у搧缂栫爜 + routecode: '', // 宸ヨ壓璺嚎缂栫爜 + stepcode: '', // 宸ュ簭缂栫爜 + + prop: 'partcode', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + partArr: [], // 浜у搧闆嗗悎 + partArr2: [], // 浜у搧闆嗗悎瀵硅瘽妗� + routeArr: [], // 宸ヨ壓璺嚎 + stepArr: [], // 宸ュ簭 + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'partcode', + label: '浜у搧缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'partname', + label: '浜у搧鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'partspec', + label: '浜у搧瑙勬牸', + id: 5, + show: true, + fixed: false, + sortable: true + }, + // { + // minWidth: 110, + // width: false, + // prop: 'wksp_code', + // label: '鐢熶骇杞﹂棿缂栫爜', + // id: 6, + // show: false, + // fixed: false, + // sortable: true + // }, + // { + // minWidth: false, + // width: 110, + // prop: 'wksp_name', + // label: '鐢熶骇杞﹂棿', + // id: 7, + // show: true, + // fixed: false, + // sortable: true + // }, + { + minWidth: 110, + width: false, + prop: 'route_code', + label: '宸ヨ壓璺嚎缂栫爜', + id: 8, + show: false, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'route_name', + label: '宸ヨ壓璺嚎', + id: 9, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'stepcode', + label: '宸ュ簭缂栫爜', + id: 10, + show: false, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'stepname', + label: '宸ュ簭鍚嶇О', + id: 11, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'unprice', + label: '璁′欢鍗曚环', + id: 12, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 13, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 14, + show: true, + fixed: false, + sortable: true + } + + ], + tableTimeStampArrayKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + dialogForm: { + partcode: '', // 浜у搧缂栫爜 + routecode: '', // 宸ヨ壓璺嚎缂栫爜 + stepcode: '', // 宸ュ簭缂栫爜 + + wkshopcode: '', // 鐢熶骇杞﹂棿缂栫爜 + eqp_value: '', // 璁惧鑺傛媿 + stand_value: '', // 鐢熶骇鑺傛媿 + cavity_qty: '', // 鍨嬭厰鏁� + unprice: ''// 璁′欢鍗曚环 + }, + routeDialogArr: [], // 宸ヨ壓璺嚎 + stepDialogArr: [], // 宸ュ簭闆嗗悎 + + editPartName: '', // 缂栬緫鏃朵骇鍝佸悕绉� + editRouteName: '', // 缂栬緫鏃跺伐鑹鸿矾绾垮悕绉� + editStepName: '', // 缂栬緫鏃跺姞宸ュ伐搴忓悕绉� + operation: '' + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + if (!this.mesSetting.route) { + this.tableColumnSettingsArray = this.tableColumnSettingsArray.filter(i => i.prop !== 'route_name') + } + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampArrayKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + handleRequest() { + this.getBeatRateSearch().then(res => { + if (res.code === '200') { + this.getPartSelect() + } + }) + }, + + async getBeatRateSearch() { + const res = await BeatRateSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getBeatRateSearch() + }, + // 鏌ヨ + search() { + this.getBeatRateSearch() + }, + async getPartSelect() { + const { data: res } = await PartSelect() + this.partArr = res + }, + async getPartSelect2() { + const { data: res } = await PartSelect() + this.partArr2 = res + }, + async partChange(val) { + const { data: res } = await PartSelectRpute({ partcode: val }) + if (this.mesSetting.route) { + this.routeArr = res + this.form.routecode = '' + } else { + this.stepArr = res + } + this.form.stepcode = '' + }, + async routeChange(val) { + const { data: res } = await RouteSelectStep({ partcode: this.form.partcode, routecode: val }) + this.stepArr = res + this.form.stepcode = '' + }, + + // 閲嶇疆 + reset() { + this.form.partcode = '' + this.form.routecode = '' + this.form.stepcode = '' + this.getBeatRateSearch() + }, + async partDialogChange(val) { + const { data: res } = await PartSelectRpute({ partcode: val }) + if (this.mesSetting.route) { + this.routeDialogArr = res + this.stepDialogArr = [] + this.dialogForm.routecode = '' + } else { + this.stepDialogArr = res + } + }, + async routeDialogChange(val) { + const { data: res } = await RouteSelectStep({ partcode: this.dialogForm.partcode, routecode: val }) + this.stepDialogArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.getPartSelect2() + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.editPartName = row.partname + this.editRouteName = row.route_name + this.editStepName = row.stepname + + await this.partDialogChange(row.partcode) + + this.dialogForm.partcode = row.partcode + if (this.mesSetting.route) { + await this.routeDialogChange(row.route_code) + } + this.dialogForm.routecode = row.route_code + this.dialogForm.stepcode = row.stepcode + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteBeatRate({ id: row.id }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getBeatRateSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.partcode = '' + this.dialogForm.routecode = '' + this.dialogForm.stepcode = '' + + this.dialogForm.wkshopcode = '' + this.dialogForm.eqp_value = '' + this.dialogForm.stand_value = '' + this.dialogForm.cavity_qty = '' + this.dialogForm.unprice = '' + this.eqpTableLength = 0 + this.routeDialogArr = [] + this.stepDialogArr = [] + + this.$refs.dialogForm.clearValidate() + this.getBeatRateSearch() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const children = [] + this.stepDialogArr.forEach(i => { + children.push({ + 'code': i.step_code, + 'name': i.step_name, + 'seq': i.step_seq, + 'isbott': i.isbott, + 'isend': i.isend, + 'unprice': i.unprice + }) + }) + + const data = [ + { + 'partcode': this.dialogForm.partcode, + 'defaultroute_code': this.dialogForm.routecode, + 'children': children + } + ] + SaveBeatRate(data).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getBeatRateSearch() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + if (window.innerHeight < 769) { + this.tableHeight = this.tableHeight - 40 + } + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> + +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/basicSettings/organizationList.vue b/src/views/basicSettings/organizationList.vue index 8a49fa3..7fe1420 100644 --- a/src/views/basicSettings/organizationList.vue +++ b/src/views/basicSettings/organizationList.vue @@ -1,440 +1,445 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="缁勭粐缂栫爜" style=" display: flex;"> - <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="缁勭粐鍚嶇О" style=" display: flex;"> - <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getSTorgData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - row-key="torg_code" - default-expand-all - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- <el-table-column--> - <!-- prop="rowNum"--> - <!-- width="120"--> - <!-- fixed--> - <!-- label="搴忓彿"--> - <!-- />--> - <el-table-column - prop="torg_code" - label="缁勭粐缂栫爜" - sortable="custom" - /> - <el-table-column - prop="torg_name" - label="缁勭粐鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="status" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <!-- <pagination--> - <!-- :total="total"--> - <!-- :page.sync="form.page"--> - <!-- :limit.sync="form.rows"--> - <!-- align="right"--> - <!-- layout="total,prev, pager, next,sizes,jumper"--> - <!-- popper-class="select_bottom"--> - <!-- @pagination="getSTorgData"--> - <!-- />--> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="缁勭粐缂栫爜" prop="OrganCode"> - <el-input v-model="dialogForm.OrganCode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="缁勭粐鍚嶇О" prop="OrganName"> - <el-input v-model="dialogForm.OrganName" style="width: 200px" /> - </el-form-item> - <el-form-item label="鎵�灞炵粍缁�" prop="storgcode"> - <el-cascader - ref="cascader" - v-model="dialogForm.storgcode" - :options="cascaderOptions" - filterable - :props="defaultProps" - :show-all-levels="false" - @change="cascaderChange" - /> - </el-form-item> - <el-form-item required label="缁勭粐鐘舵��"> - <el-radio-group v-model="dialogForm.status"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateOrganization, - DeleteOrganization, - STorgData -} from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import arrayToTree from 'array-to-tree' -import { PrentOrganization } from '@/api/GeneralBasicData' - -export default { - name: 'OrganizationList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - storg_code: '', // 缁勭粐鏋舵瀯缂栫爜 - storg_name: '' // 缁勭粐鏋舵瀯鍚嶇О - // prop: 'lm_date', // 鎺掑簭瀛楁 - // order: 'desc', // 鎺掑簭瀛楁 - // page: 1, // 绗嚑椤� - // rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - OrganCode: '', // 缁勭粐缂栫爜 - OrganName: '', // 缁勭粐鍚嶇О - leve: 0, // 灞傜骇缂栫爜 - storgcode: '', // 鐖剁骇缂栫爜 - parent_id: '', // 鍘焢id - torg_seq: '', // 鎺掑簭 - status: 'Y'// 鐘舵�� - }, - operation: '', - dialogFormRules: { - OrganCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrganName: [ - { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } - ], - storgcode: [ - { required: true, message: '璇烽�夋嫨鎵�灞炵粍缁�', trigger: ['blur', 'change'] } - ] - }, - defaultProps: { - checkStrictly: true, - expandTrigger: 'hover', - value: 'torg_code', - label: 'torg_name' - }, - Options: [], - cascaderOptions: [] - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getSTorgData() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getSTorgData() { - const res = await STorgData(this.form) - this.tableData = arrayToTree(res.data, { - parentProperty: 'parent_id', - customID: 'torg_code', - childrenProperty: 'children' - }) - this.total = res.count - }, - // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� - async getPrentOrganization() { - const { data: res } = await PrentOrganization() - this.Options = res - this.cascaderOptions = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'torg_code', - childrenProperty: 'children' - }) - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getSTorgData() - }, - // 閲嶇疆 - reset() { - this.form.storg_code = '' - this.form.storg_name = '' - this.getSTorgData() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - this.getPrentOrganization() - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - await this.getPrentOrganization() - this.cascaderOptions = this.filterChildren(this.cascaderOptions, row.torg_code) - this.$nextTick(() => { - this.dialogForm.OrganCode = row.torg_code - this.dialogForm.OrganName = row.torg_name - this.dialogForm.leve = parseFloat(row.leve) - this.dialogForm.torg_seq = row.torg_seq - this.dialogForm.status = row.status - this.dialogForm.storgcode = this.findParent([], row.parent_id, this.cascaderOptions).reverse() - this.dialogForm.parent_id = row.parent_id - }) - }, - filterChildren(treeData, code) { - treeData.forEach(item => { - if (code.split(',').includes(item.torg_code)) { - item.disabled = true - if (item.children && item.children.length > 0) { - this.filterChildren(item.children, item.children.map(it => it.torg_code).join(',')) - } - } else { - if (item.children && item.children.length > 0) { - this.filterChildren(item.children, code) - } - } - }) - return treeData - }, - // parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁 - findParent(parents, childNode, treeData) { - // console.log(parents, childNode, treeData, 2) - for (let i = 0; i < treeData.length; i++) { - // 鐖惰妭鐐规煡璇㈡潯浠� - if (treeData[i].torg_code === childNode) { - // 濡傛灉鎵惧埌缁撴灉,淇濆瓨褰撳墠鑺傜偣 - parents.push(treeData[i].torg_code) - // 鐢ㄥ綋鍓嶈妭鐐瑰啀鍘诲師鏁版嵁鏌ユ壘褰撳墠鑺傜偣鐨勭埗鑺傜偣 - this.findParent(parents, treeData[i].parent_id, this.cascaderOptions) - break - } else { - if (treeData[i].children instanceof Array) { - // 娌℃壘鍒帮紝閬嶅巻璇ヨ妭鐐圭殑瀛愯妭鐐� - this.findParent(parents, childNode, treeData[i].children) - } - } - } - return parents - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteOrganization({ orgcode: row.torg_code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getSTorgData() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrganCode = '' - this.dialogForm.OrganName = '' - this.dialogForm.storgcode = '' - this.dialogForm.parent_id = '' - this.dialogForm.status = 'Y' - this.dialogForm.leve = 0 - this.$refs.cascader.checkedValue = '' - this.$refs.dialogForm.clearValidate() - }, - cascaderChange(val) { - const temp = this.Options.find(i => i.torg_code === val[val.length - 1]) - this.dialogForm.storgcode = val - this.dialogForm.leve = parseFloat(temp.leve) + 1 - this.dialogForm.torg_seq = this.Options.filter(i => i.parent_id === val[val.length - 1]).length + 1 - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - this.dialogForm.storgcode = this.dialogForm.storgcode[this.dialogForm.storgcode.length - 1] - AddUpdateOrganization(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getSTorgData() - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - this.$store.state.app.buttonIsDisabled = false - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 137 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="缁勭粐缂栫爜" style=" display: flex;"> + <el-input v-model="form.storg_code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="缁勭粐鍚嶇О" style=" display: flex;"> + <el-input v-model="form.storg_name" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getSTorgData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + row-key="torg_code" + default-expand-all + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- <el-table-column--> + <!-- prop="rowNum"--> + <!-- width="120"--> + <!-- fixed--> + <!-- label="搴忓彿"--> + <!-- />--> + <el-table-column + prop="torg_code" + label="缁勭粐缂栫爜" + sortable="custom" + /> + <el-table-column + prop="torg_name" + label="缁勭粐鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="status" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <!-- <pagination--> + <!-- :total="total"--> + <!-- :page.sync="form.page"--> + <!-- :limit.sync="form.rows"--> + <!-- align="right"--> + <!-- layout="total,prev, pager, next,sizes,jumper"--> + <!-- popper-class="select_bottom"--> + <!-- @pagination="getSTorgData"--> + <!-- />--> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="缁勭粐缂栫爜" prop="OrganCode"> + <el-input v-model="dialogForm.OrganCode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="缁勭粐鍚嶇О" prop="OrganName"> + <el-input v-model="dialogForm.OrganName" style="width: 200px" /> + </el-form-item> + <el-form-item label="鎵�灞炵粍缁�" prop="storgcode"> + <el-cascader + ref="cascader" + v-model="dialogForm.storgcode" + :options="cascaderOptions" + filterable + :props="defaultProps" + :show-all-levels="false" + @change="cascaderChange" + /> + </el-form-item> + <el-form-item required label="缁勭粐鐘舵��"> + <el-radio-group v-model="dialogForm.status"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateOrganization, + DeleteOrganization, + STorgData +} from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import arrayToTree from 'array-to-tree' +import { PrentOrganization } from '@/api/GeneralBasicData' + +export default { + name: 'OrganizationList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + storg_code: '', // 缁勭粐鏋舵瀯缂栫爜 + storg_name: '' // 缁勭粐鏋舵瀯鍚嶇О + // prop: 'lm_date', // 鎺掑簭瀛楁 + // order: 'desc', // 鎺掑簭瀛楁 + // page: 1, // 绗嚑椤� + // rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + OrganCode: '', // 缁勭粐缂栫爜 + OrganName: '', // 缁勭粐鍚嶇О + leve: 0, // 灞傜骇缂栫爜 + storgcode: '', // 鐖剁骇缂栫爜 + parent_id: '', // 鍘焢id + torg_seq: '', // 鎺掑簭 + status: 'Y'// 鐘舵�� + }, + operation: '', + dialogFormRules: { + OrganCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrganName: [ + { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } + ], + storgcode: [ + { required: true, message: '璇烽�夋嫨鎵�灞炵粍缁�', trigger: ['blur', 'change'] } + ] + }, + defaultProps: { + checkStrictly: true, + expandTrigger: 'hover', + value: 'torg_code', + label: 'torg_name' + }, + Options: [], + cascaderOptions: [] + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getSTorgData() + }, + created() { + this.getSTorgData() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getSTorgData() { + const res = await STorgData(this.form) + this.tableData = arrayToTree(res.data, { + parentProperty: 'parent_id', + customID: 'torg_code', + childrenProperty: 'children' + }) + this.total = res.count + }, + // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� + async getPrentOrganization() { + const { data: res } = await PrentOrganization() + this.Options = res + this.cascaderOptions = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'torg_code', + childrenProperty: 'children' + }) + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getSTorgData() + }, + // 閲嶇疆 + reset() { + this.form.storg_code = '' + this.form.storg_name = '' + this.getSTorgData() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + this.getPrentOrganization() + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + await this.getPrentOrganization() + this.cascaderOptions = this.filterChildren(this.cascaderOptions, row.torg_code) + this.$nextTick(() => { + this.dialogForm.OrganCode = row.torg_code + this.dialogForm.OrganName = row.torg_name + this.dialogForm.leve = parseFloat(row.leve) + this.dialogForm.torg_seq = row.torg_seq + this.dialogForm.status = row.status + this.dialogForm.storgcode = this.findParent([], row.parent_id, this.cascaderOptions).reverse() + this.dialogForm.parent_id = row.parent_id + }) + }, + filterChildren(treeData, code) { + treeData.forEach(item => { + if (code.split(',').includes(item.torg_code)) { + item.disabled = true + if (item.children && item.children.length > 0) { + this.filterChildren(item.children, item.children.map(it => it.torg_code).join(',')) + } + } else { + if (item.children && item.children.length > 0) { + this.filterChildren(item.children, code) + } + } + }) + return treeData + }, + // parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁 + findParent(parents, childNode, treeData) { + // console.log(parents, childNode, treeData, 2) + for (let i = 0; i < treeData.length; i++) { + // 鐖惰妭鐐规煡璇㈡潯浠� + if (treeData[i].torg_code === childNode) { + // 濡傛灉鎵惧埌缁撴灉,淇濆瓨褰撳墠鑺傜偣 + parents.push(treeData[i].torg_code) + // 鐢ㄥ綋鍓嶈妭鐐瑰啀鍘诲師鏁版嵁鏌ユ壘褰撳墠鑺傜偣鐨勭埗鑺傜偣 + this.findParent(parents, treeData[i].parent_id, this.cascaderOptions) + break + } else { + if (treeData[i].children instanceof Array) { + // 娌℃壘鍒帮紝閬嶅巻璇ヨ妭鐐圭殑瀛愯妭鐐� + this.findParent(parents, childNode, treeData[i].children) + } + } + } + return parents + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteOrganization({ orgcode: row.torg_code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getSTorgData() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrganCode = '' + this.dialogForm.OrganName = '' + this.dialogForm.storgcode = '' + this.dialogForm.parent_id = '' + this.dialogForm.status = 'Y' + this.dialogForm.leve = 0 + this.$refs.cascader.checkedValue = '' + this.$refs.dialogForm.clearValidate() + }, + cascaderChange(val) { + const temp = this.Options.find(i => i.torg_code === val[val.length - 1]) + this.dialogForm.storgcode = val + this.dialogForm.leve = parseFloat(temp.leve) + 1 + this.dialogForm.torg_seq = this.Options.filter(i => i.parent_id === val[val.length - 1]).length + 1 + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + this.dialogForm.storgcode = this.dialogForm.storgcode[this.dialogForm.storgcode.length - 1] + AddUpdateOrganization(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getSTorgData() + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + this.$store.state.app.buttonIsDisabled = false + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 137 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/personList.vue b/src/views/basicSettings/personList.vue index 57ca8b4..1505d2b 100644 --- a/src/views/basicSettings/personList.vue +++ b/src/views/basicSettings/personList.vue @@ -557,6 +557,9 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getUserData() + this.getPrentOrganization() + this.getAllSelectData() }, created() { this.getUserData() diff --git a/src/views/basicSettings/postList.vue b/src/views/basicSettings/postList.vue index 042d3cc..0098b22 100644 --- a/src/views/basicSettings/postList.vue +++ b/src/views/basicSettings/postList.vue @@ -1,367 +1,372 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=1')" - >瀵煎叆 - </el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宀椾綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.postcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="宀椾綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.postname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getPostData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="postcode" - label="宀椾綅缂栫爜" - sortable="custom" - /> - <el-table-column - prop="postname" - label="宀椾綅鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="status" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - prop="description" - label="鎻忚堪" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description ? row.description : '/' }} - </template> - </el-table-column> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getPostData" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="宀椾綅缂栫爜" prop="postcode"> - <el-input v-model="dialogForm.postcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="宀椾綅鍚嶇О" prop="postname"> - <el-input v-model="dialogForm.postname" style="width: 200px" /> - </el-form-item> - <el-form-item label="鎻忚堪"> - <el-input - v-model="dialogForm.description" - type="textarea" - style="width: 200px" - /> - </el-form-item> - <el-form-item required label="宀椾綅鐘舵��"> - <el-radio-group v-model="dialogForm.status"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdatePost, DeletePost, PostData } from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' - -export default { - name: 'PersonList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - postcode: '', // 缁勭粐鏋舵瀯缂栫爜 - postname: '', // 缁勭粐鏋舵瀯鍚嶇О - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - postcode: '', // 缁勭粐缂栫爜 - postname: '', // 缁勭粐鍚嶇О - description: '', // 鎻忚堪 - status: 'Y'// 鐘舵�� - }, - operation: '', - dialogFormRules: { - postcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - postname: [ - { required: true, message: '璇疯緭鍏ュ矖浣嶅悕绉�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getPostData() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getPostData() { - const res = await PostData(this.form) - this.tableData = res.data - this.total = res.count - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getPostData() - }, - // 閲嶇疆 - reset() { - this.form.postcode = '' - this.form.postname = '' - this.getPostData() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - this.dialogForm.postcode = row.postcode - this.dialogForm.postname = row.postname - this.dialogForm.description = row.description - this.dialogForm.status = row.status - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeletePost({ postcode: row.postcode }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getPostData() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.postcode = '' - this.dialogForm.postname = '' - this.dialogForm.status = 'Y' - this.dialogForm.description = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - AddUpdatePost(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getPostData() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=1')" + >瀵煎叆 + </el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宀椾綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.postcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="宀椾綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.postname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getPostData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="postcode" + label="宀椾綅缂栫爜" + sortable="custom" + /> + <el-table-column + prop="postname" + label="宀椾綅鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="status" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + prop="description" + label="鎻忚堪" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description ? row.description : '/' }} + </template> + </el-table-column> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getPostData" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="宀椾綅缂栫爜" prop="postcode"> + <el-input v-model="dialogForm.postcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="宀椾綅鍚嶇О" prop="postname"> + <el-input v-model="dialogForm.postname" style="width: 200px" /> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input + v-model="dialogForm.description" + type="textarea" + style="width: 200px" + /> + </el-form-item> + <el-form-item required label="宀椾綅鐘舵��"> + <el-radio-group v-model="dialogForm.status"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdatePost, DeletePost, PostData } from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' + +export default { + name: 'PersonList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + postcode: '', // 缁勭粐鏋舵瀯缂栫爜 + postname: '', // 缁勭粐鏋舵瀯鍚嶇О + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + postcode: '', // 缁勭粐缂栫爜 + postname: '', // 缁勭粐鍚嶇О + description: '', // 鎻忚堪 + status: 'Y'// 鐘舵�� + }, + operation: '', + dialogFormRules: { + postcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + postname: [ + { required: true, message: '璇疯緭鍏ュ矖浣嶅悕绉�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getPostData() + }, + created() { + this.getPostData() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getPostData() { + const res = await PostData(this.form) + this.tableData = res.data + this.total = res.count + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getPostData() + }, + // 閲嶇疆 + reset() { + this.form.postcode = '' + this.form.postname = '' + this.getPostData() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + this.dialogForm.postcode = row.postcode + this.dialogForm.postname = row.postname + this.dialogForm.description = row.description + this.dialogForm.status = row.status + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeletePost({ postcode: row.postcode }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getPostData() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.postcode = '' + this.dialogForm.postname = '' + this.dialogForm.status = 'Y' + this.dialogForm.description = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + AddUpdatePost(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getPostData() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/powerDivider.vue b/src/views/basicSettings/powerDivider.vue index 8b7e629..8d0e266 100644 --- a/src/views/basicSettings/powerDivider.vue +++ b/src/views/basicSettings/powerDivider.vue @@ -1,548 +1,553 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div - class="elTableDiv" - > - - <div style="width: 300px;background:#fff"> - - <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> - <div style="display: flex;"> - <div - style="width: 5px;height: 100%;border-radius: 5px;" - :style="{background:$store.state.settings.theme}" - /> - <div style="margin-left: 8px;">瑙掕壊鍚嶇О</div> - </div> - - <!-- <div style="margin-right:10px">--> - <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="rolePlusClick" />--> - <!-- </div>--> - - </div> - - <el-tree - ref="treeLeftRef" - style="padding: 10px;overflow: auto" - :style="{height:(tableHeight-20)+'px'}" - :data="treeLeft" - node-key="code" - highlight-current - :props="defaultPropsLeft" - :default-expand-all="true" - :expand-on-click-node="false" - @node-click="treeLeftNodeClick" - /> - <!-- draggable--> - <!-- :allow-drop="treeLeftAllowDrop"--> - </div> - - <div - style="margin-left: 10px;width: calc(100% - 300px);position: relative" - > - - <el-button - style="position: absolute;right: 15px;z-index:1;top:3px" - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="saveClick" - >淇� 瀛� - </el-button> - - <el-tabs v-model="activeName" type="border-card" @tab-click="tabClick"> - <el-tab-pane label="PC绔�" name="PC"> - <div style="display: flex;"> - <div - ref="scrollLeft" - style="border-right: 1px solid rgba(0,0,0,0.2);width:100%; - overflow-y: auto;overflow-x:hidden;" - :style="{height:(tableHeight-40)+'px'}" - @scroll="scrollLeftScroll()" - @mouseover="isScroll='left'" - > - <div style=" "> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺 - </div> - - <el-tree - ref="treeCenterPCRef" - style="padding-top: 10px;" - :data="treeCenter" - highlight-current - :props="defaultPropsCenter" - show-checkbox - node-key="menucode" - :default-expand-all="true" - @check-change="handleTreeCenterCheckChange" - @check="handleTreeCenterCheck" - @node-click="getLeftTreeNode" - /> - </div> - <!-- <div--> - <!-- ref="scrollCenter"--> - <!-- style="width: calc(100% - 260px );padding-left: 10px;overflow-y: auto;"--> - <!-- :style="{height:(tableHeight-40)+'px'}"--> - <!-- @scroll="scrollCenterScroll()"--> - <!-- @mouseover="isScroll='center'"--> - <!-- >--> - <!-- <div style=" ">--> - <!-- <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鎸夐挳鏉冮檺--> - <!-- </div>--> - - <!-- <el-checkbox--> - <!-- v-model="buttonIsChecked"--> - <!-- style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"--> - <!-- @change=" handleCheckAllChange "--> - <!-- >鍏ㄩ��--> - <!-- </el-checkbox>--> - - <!-- <div v-if="treeCenter.length>0">--> - <!-- <div v-for="(item,index) in treeCenter[0].children" :key="item.menucode">--> - - <!-- <div--> - <!-- v-if="!item.buttoncodelist"--> - <!-- style="margin-left: 40px;height:26px;display: flex;"--> - <!-- />--> - - <!-- <el-checkbox-group--> - <!-- v-for="it in item.children"--> - <!-- v-if="item.expanded"--> - <!-- :key="it.menucode"--> - <!-- v-model="it.buttonChecked"--> - <!-- style="margin-left: 40px;height:26px;display: flex;"--> - <!-- @change="val=>handleCheckedButtonChange(val,it.menucode,it.buttonChecked)"--> - <!-- >--> - - <!-- <el-checkbox--> - <!-- v-for="i in it.buttoncodelist"--> - <!-- :key="i"--> - <!-- :label="i"--> - <!-- style="display:flex;align-items: center;"--> - <!-- />--> - <!-- </el-checkbox-group>--> - - <!-- </div>--> - - <!-- </div>--> - - <!-- </div>--> - </div> - </el-tab-pane> - <el-tab-pane label="APP绔�" name="APP"> - <div style="display: flex;"> - <div - ref="scrollLeft" - style="border-right: 1px solid rgba(0,0,0,0.2);width:100%; - overflow-y: auto;overflow-x:hidden;" - :style="{height:(tableHeight-40)+'px'}" - @scroll="scrollLeftScroll()" - @mouseover="isScroll='left'" - > - <div style=" "> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺 - </div> - - <el-tree - ref="treeCenterAPPRef" - style="padding-top: 10px;" - :data="treeCenter" - highlight-current - :props="defaultPropsCenter" - show-checkbox - node-key="menucode" - :default-expand-all="true" - @check-change="handleTreeCenterCheckChange" - @check="handleTreeCenterCheck" - @node-click="getLeftTreeNode" - /> - </div> - </div> - </el-tab-pane> - <!-- <el-tab-pane label="宸ユ帶绔�" name="宸ユ帶绔�">宸ユ帶绔�</el-tab-pane>--> - </el-tabs> - - </div> - - </div> - - </div> - - </div> -</template> - -<script> -import waves from '@/directive/waves' -import { - RolePermissionSava, - RolePermissionSearchRole, - RolePermissionSearchRoleMenu, - RolePermissionSearchRoleMenuButton -} from '@/api/basicSettings' -import arrayToTree from 'array-to-tree' - -export default { - name: 'PowerDivider', - directives: { waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - - treeLeft: [], // 宸︿晶鏍� - treeCenter: [], // 涓棿鏍� - defaultPropsLeft: { - children: 'roles', - label: 'name' - }, - defaultPropsCenter: { - children: 'children', - label: 'menuname' - }, - activeName: 'PC', - - buttonIsChecked: false, - - menuCheckedCodeArr: [], // 鑿滃崟鏉冮檺鏁扮粍閫変腑鐨� - - allButtonData: [], // 鎵�鏈夎彍鍗曞搴旂殑鎸夐挳鏉冮檺鍔犳暟鎹潈闄� - - isScroll: 'left', - - ButtonData: JSON.parse(localStorage.getItem('ButtonData')) - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getRolePermissionSearchRole() - }, - methods: { - - // 鑾峰彇瑙掕壊鏉冮檺鏌ヨ瑙掕壊 - async getRolePermissionSearchRole() { - const { data: res } = await RolePermissionSearchRole() - this.treeLeft = res - - let rolecode = '' - if (window.location.hash.indexOf('?') !== -1) { - rolecode = window.location.hash.split('?')[1].split('=')[1] - } - - if (res && res.length > 0) { - this.$nextTick(() => { // 榛樿閫変腑绗竴涓� - this.$refs.treeLeftRef.setCurrentKey(rolecode || res[0].code) // 榛樿閫変腑鑺傜偣绗竴涓� - }) - - await this.getRolePermissionSearchRoleMenuButton(rolecode || res[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉 - - await this.getRolePermissionSearchRoleMenu(rolecode || res[0].code)// 鐢ㄤ簬娓叉煋椤甸潰 - } else { - this.$notify.error('璇峰厛寤虹浉瀵瑰簲鐨勮鑹诧紒') - } - }, - async tabClick() { - this.treeCenter = [] - await this.getRolePermissionSearchRoleMenuButton(this.$refs.treeLeftRef.getCurrentKey())// 鐢ㄤ簬鏁版嵁鍥炴樉 - await this.getRolePermissionSearchRoleMenu(this.$refs.treeLeftRef.getCurrentKey())// 鐢ㄤ簬娓叉煋椤甸潰 - }, - - // 鑾峰彇鑿滃崟鏉冮檺瀵瑰簲鐨勬寜閽� - async getRolePermissionSearchRoleMenuButton(rolecode) { - const { data: res } = await RolePermissionSearchRoleMenuButton({ rolecode, type: this.activeName }) - this.allButtonData = res.length > 0 ? JSON.parse(res[0].jsondate) : [] - }, - // 鑾峰彇鑿滃崟鏉冮檺 - async getRolePermissionSearchRoleMenu(rolecode) { - const { data: res } = await RolePermissionSearchRoleMenu({ rolecode, type: this.activeName }) - - // 鎷垮埌鏁扮粍list杞崲鎴愭爲褰ree - const result = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'menucode', - childrenProperty: 'children' - }) - - this.treeCenter = [ - { menucode: '-1', menuname: '鍏ㄩ儴', children: result } - ] - - this.treeCenter[0].children.sort((a, b) => a.menu_seq - b.menu_seq) - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - it.buttoncodelist = it.buttoncodelist !== '' && it.buttoncodelist !== null ? it.buttoncodelist.split(',') : [] - if (it.buttoncodelist && it.buttoncodelist.length > 0) { - it.buttoncodelist = this.ButtonData.filter(j => - it.buttoncodelist.includes(j.buttoncode) - ) - - it.buttoncodelist = it.buttoncodelist.map(j => j.buttonname) - } - }) - - item.children.sort((a, b) => a.menu_seq - b.menu_seq) - - item.expanded = true - } - }) - - this.handleData()// 澶勭悊鏁版嵁鍥炴樉 - }, - // 澶勭悊缁勫悎鏁版嵁 - handleData() { - this.menuCheckedCodeArr = this.allButtonData.map(i => i.menucode) - this.$nextTick(() => { - if (this.activeName === 'PC') { - this.$refs.treeCenterPCRef.setCheckedKeys(this.menuCheckedCodeArr) - } - if (this.activeName === 'APP') { - this.$refs.treeCenterAPPRef.setCheckedKeys(this.menuCheckedCodeArr) - } - }) - - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : [] - temp = temp.length > 0 ? temp.split(',') : [] - it.buttonChecked = [] // 鏁版嵁鍥炴樉 - this.ButtonData.forEach(j => { - if (temp.includes(j.buttoncode)) { - it.buttonChecked.push(j.buttonname) - } - }) - }) - } - }) - - this.handleCheckedButtonChange('', '', '', true) - // this.$forceUpdate() - }, - - // 宸﹁竟婊氬姩鏉℃粦鍔ㄦ椂 - scrollLeftScroll() { - if (this.isScroll === 'left') { - this.$refs.scrollCenter.scrollTop = this.$refs.scrollLeft.scrollTop - } - }, - // 涓棿杈规粴鍔ㄦ潯婊戝姩鏃� - scrollCenterScroll() { - if (this.isScroll === 'center') { - this.$refs.scrollLeft.scrollTop = this.$refs.scrollCenter.scrollTop - } - }, - - // 鍏ㄩ�夋敼鍙� - handleCheckAllChange(val) { - let checkedKeys - if (this.activeName === 'PC') { - checkedKeys = this.$refs.treeCenterPCRef.getCheckedKeys() - } - if (this.activeName === 'APP') { - checkedKeys = this.$refs.treeCenterAPPRef.getCheckedKeys() - } - - if (val) { - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (checkedKeys.includes(it.menucode)) { - it.buttonChecked = it.buttoncodelist - } - }) - } - }) - } else { - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (checkedKeys.includes(it.menucode)) { - it.buttonChecked = [] - } - }) - } - }) - } - }, - // 鍗曚釜鎸夐挳鏀瑰彉 - handleCheckedButtonChange(oldValue, code, newValue, flag) { - // console.log(oldValue, code, newValue, 2) - // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴 - if (!flag) { - if (!this.menuCheckedCodeArr.includes(code) && oldValue.length === 0 && newValue.length === 1) { // 鍚� - this.menuCheckedCodeArr.push(code) - } else if (this.menuCheckedCodeArr.includes(code) && oldValue.length === 1 && newValue.length === 0) { // 鏄� - this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== code) - } - if (this.activeName === 'PC') { - this.$refs.treeCenterPCRef.setCheckedKeys(this.menuCheckedCodeArr) - } - if (this.activeName === 'APP') { - this.$refs.treeCenterAPPRef.setCheckedKeys(this.menuCheckedCodeArr) - } - } - - // 杩欓噷鏄垽鏂叏閫塩heckbox 鏄惁閫変腑 - let count = 0 - let childrenLength = 0 - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (it.buttonChecked && it.buttonChecked.length === it.buttoncodelist.length && it.buttoncodelist.length > 0) { - count++ - } - - if (it.buttoncodelist.length) { - childrenLength++ - } - }) - } - }) - - this.buttonIsChecked = count === childrenLength - this.$forceUpdate() - }, - // 鑾峰彇鏍戝舰鑺傜偣node - getLeftTreeNode(data, Node, VueComponent) { - this.treeCenter[0].children.forEach(item => { - if (item.menucode === data.menucode) { - item.expanded = Node.expanded - } - }) - if (data.menucode === '-1') { - Node.expanded = true // 鏆傛椂鍏堝啓鎴愯繖涓� - } - this.$forceUpdate() - }, - // 澶勭悊涓棿鏍戝舰鍕鹃�� - handleTreeCenterCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { - // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, '鍔犲瀹�') - - if (checkedKeys.length === 0) { // 鏍戝舰鑿滃崟鍏ㄤ笉閫夌殑鎯呭喌涓� - this.buttonIsChecked = false - this.menuCheckedCodeArr = [] - } else { - if (checkedKeys.includes(obj.menucode)) { // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴 //鏄� - this.menuCheckedCodeArr.push(obj.menucode) - } else { // 鍚� - this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode) - } - } - }, - // 澶勭悊涓棿鏍戝舰閫変腑鍊兼敼鍙� - handleTreeCenterCheckChange(obj, selfChecked, selfChildrenTreeCheck) { - // console.log(obj, selfChecked, selfChildrenTreeCheck, '鐜嬭�佸悏') - if (!selfChildrenTreeCheck) { - if (!selfChecked) { // 浠庨�変腑鍒颁笉閫変腑 - obj.buttonChecked = [] - this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode) - } - if (selfChecked) { // 浠庝笉閫変腑鍒伴�変腑 - obj.buttonCheckedCode = [] - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (it.menucode === obj.menucode) { - this.menuCheckedCodeArr.push(obj.menucode) - } - }) - } - }) - } - - this.$forceUpdate() - } - }, - // 瑙掕壊鍒囨崲 - async treeLeftNodeClick(obj, Node, VueComponent) { - if (obj.code !== '000') { - await this.getRolePermissionSearchRoleMenuButton(obj.code) - this.handleData() - } - }, - // 椤甸潰鍕鹃�夊ソ淇濆瓨浜嬩欢 - async saveClick() { - const rolecode = this.$refs.treeLeftRef.getCurrentKey() - const datacode = this.treeLeft.find(i => i.code === rolecode).datarange !== 'CUSTOM' ? this.treeLeft.find(i => i.code === rolecode).datarange : this.treeLeft.find(i => i.code === rolecode).datapermissions - let menuKeyArr - if (this.activeName === 'PC') { - menuKeyArr = this.$refs.treeCenterPCRef.getCheckedKeys() - } - if (this.activeName === 'APP') { - menuKeyArr = this.$refs.treeCenterAPPRef.getCheckedKeys() - } - - const arr = [] - this.treeCenter[0].children.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (menuKeyArr.includes(it.menucode)) { - if (it.buttonChecked && it.buttonChecked.length > 0) { // 宸查�夎彍鍗� - it.buttonCheckedCode = this.ButtonData.filter(i => - it.buttonChecked.includes(i.buttonname) - ).map(i => i.buttoncode) - } - arr.push({ - menucode: it.menucode, - datacode, - buttoncode: it.buttonCheckedCode ? it.buttonCheckedCode.join(',') : '' - }) - } - }) - } - }) - this.$store.state.app.buttonIsDisabled = true - - const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName) - if (res.code === '200') { - const rolename = this.treeLeft.find(i => i.code === rolecode).name - this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒') - await this.getRolePermissionSearchRoleMenuButton(rolecode) - this.$store.state.app.buttonIsDisabled = false - } - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 50 - }) - }, - // 宸︿晶鏍戝舰鎷栧姩澶勭悊 - treeLeftAllowDrop(draggingNode, dropNode, type) { - // console.log(draggingNode, dropNode, type) - // 娉ㄦ帀鐨勬槸鍚岀骇鎷栨嫿 - if (draggingNode.level === dropNode.level) { - return type === 'prev' || type === 'next' - } else { - // 涓嶅悓绾ц繘琛屽鐞� - return false - } - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-checkbox__label { - width: 55px; -} - -.el-checkbox-group { - margin-left: 0 !important; - padding-left: 40px; -} - -.el-checkbox-group:hover { - background: #f0f7ff; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div + class="elTableDiv" + > + + <div style="width: 300px;background:#fff"> + + <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> + <div style="display: flex;"> + <div + style="width: 5px;height: 100%;border-radius: 5px;" + :style="{background:$store.state.settings.theme}" + /> + <div style="margin-left: 8px;">瑙掕壊鍚嶇О</div> + </div> + + <!-- <div style="margin-right:10px">--> + <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="rolePlusClick" />--> + <!-- </div>--> + + </div> + + <el-tree + ref="treeLeftRef" + style="padding: 10px;overflow: auto" + :style="{height:(tableHeight-20)+'px'}" + :data="treeLeft" + node-key="code" + highlight-current + :props="defaultPropsLeft" + :default-expand-all="true" + :expand-on-click-node="false" + @node-click="treeLeftNodeClick" + /> + <!-- draggable--> + <!-- :allow-drop="treeLeftAllowDrop"--> + </div> + + <div + style="margin-left: 10px;width: calc(100% - 300px);position: relative" + > + + <el-button + style="position: absolute;right: 15px;z-index:1;top:3px" + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="saveClick" + >淇� 瀛� + </el-button> + + <el-tabs v-model="activeName" type="border-card" @tab-click="tabClick"> + <el-tab-pane label="PC绔�" name="PC"> + <div style="display: flex;"> + <div + ref="scrollLeft" + style="border-right: 1px solid rgba(0,0,0,0.2);width:100%; + overflow-y: auto;overflow-x:hidden;" + :style="{height:(tableHeight-40)+'px'}" + @scroll="scrollLeftScroll()" + @mouseover="isScroll='left'" + > + <div style=" "> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺 + </div> + + <el-tree + ref="treeCenterPCRef" + style="padding-top: 10px;" + :data="treeCenter" + highlight-current + :props="defaultPropsCenter" + show-checkbox + node-key="menucode" + :default-expand-all="true" + @check-change="handleTreeCenterCheckChange" + @check="handleTreeCenterCheck" + @node-click="getLeftTreeNode" + /> + </div> + <!-- <div--> + <!-- ref="scrollCenter"--> + <!-- style="width: calc(100% - 260px );padding-left: 10px;overflow-y: auto;"--> + <!-- :style="{height:(tableHeight-40)+'px'}"--> + <!-- @scroll="scrollCenterScroll()"--> + <!-- @mouseover="isScroll='center'"--> + <!-- >--> + <!-- <div style=" ">--> + <!-- <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鎸夐挳鏉冮檺--> + <!-- </div>--> + + <!-- <el-checkbox--> + <!-- v-model="buttonIsChecked"--> + <!-- style="height: 26px;display:flex;align-items: center;margin-top:10px;width:200px"--> + <!-- @change=" handleCheckAllChange "--> + <!-- >鍏ㄩ��--> + <!-- </el-checkbox>--> + + <!-- <div v-if="treeCenter.length>0">--> + <!-- <div v-for="(item,index) in treeCenter[0].children" :key="item.menucode">--> + + <!-- <div--> + <!-- v-if="!item.buttoncodelist"--> + <!-- style="margin-left: 40px;height:26px;display: flex;"--> + <!-- />--> + + <!-- <el-checkbox-group--> + <!-- v-for="it in item.children"--> + <!-- v-if="item.expanded"--> + <!-- :key="it.menucode"--> + <!-- v-model="it.buttonChecked"--> + <!-- style="margin-left: 40px;height:26px;display: flex;"--> + <!-- @change="val=>handleCheckedButtonChange(val,it.menucode,it.buttonChecked)"--> + <!-- >--> + + <!-- <el-checkbox--> + <!-- v-for="i in it.buttoncodelist"--> + <!-- :key="i"--> + <!-- :label="i"--> + <!-- style="display:flex;align-items: center;"--> + <!-- />--> + <!-- </el-checkbox-group>--> + + <!-- </div>--> + + <!-- </div>--> + + <!-- </div>--> + </div> + </el-tab-pane> + <el-tab-pane label="APP绔�" name="APP"> + <div style="display: flex;"> + <div + ref="scrollLeft" + style="border-right: 1px solid rgba(0,0,0,0.2);width:100%; + overflow-y: auto;overflow-x:hidden;" + :style="{height:(tableHeight-40)+'px'}" + @scroll="scrollLeftScroll()" + @mouseover="isScroll='left'" + > + <div style=" "> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 鑿滃崟鏉冮檺 + </div> + + <el-tree + ref="treeCenterAPPRef" + style="padding-top: 10px;" + :data="treeCenter" + highlight-current + :props="defaultPropsCenter" + show-checkbox + node-key="menucode" + :default-expand-all="true" + @check-change="handleTreeCenterCheckChange" + @check="handleTreeCenterCheck" + @node-click="getLeftTreeNode" + /> + </div> + </div> + </el-tab-pane> + <!-- <el-tab-pane label="宸ユ帶绔�" name="宸ユ帶绔�">宸ユ帶绔�</el-tab-pane>--> + </el-tabs> + + </div> + + </div> + + </div> + + </div> +</template> + +<script> +import waves from '@/directive/waves' +import { + RolePermissionSava, + RolePermissionSearchRole, + RolePermissionSearchRoleMenu, + RolePermissionSearchRoleMenuButton +} from '@/api/basicSettings' +import arrayToTree from 'array-to-tree' + +export default { + name: 'PowerDivider', + directives: { waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + + treeLeft: [], // 宸︿晶鏍� + treeCenter: [], // 涓棿鏍� + defaultPropsLeft: { + children: 'roles', + label: 'name' + }, + defaultPropsCenter: { + children: 'children', + label: 'menuname' + }, + activeName: 'PC', + + buttonIsChecked: false, + + menuCheckedCodeArr: [], // 鑿滃崟鏉冮檺鏁扮粍閫変腑鐨� + + allButtonData: [], // 鎵�鏈夎彍鍗曞搴旂殑鎸夐挳鏉冮檺鍔犳暟鎹潈闄� + + isScroll: 'left', + + ButtonData: JSON.parse(localStorage.getItem('ButtonData')) + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getRolePermissionSearchRole() + }, + created() { + + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getRolePermissionSearchRole() + }, + methods: { + + // 鑾峰彇瑙掕壊鏉冮檺鏌ヨ瑙掕壊 + async getRolePermissionSearchRole() { + const { data: res } = await RolePermissionSearchRole() + this.treeLeft = res + + let rolecode = '' + if (window.location.hash.indexOf('?') !== -1) { + rolecode = window.location.hash.split('?')[1].split('=')[1] + } + + if (res && res.length > 0) { + this.$nextTick(() => { // 榛樿閫変腑绗竴涓� + this.$refs.treeLeftRef.setCurrentKey(rolecode || res[0].code) // 榛樿閫変腑鑺傜偣绗竴涓� + }) + + await this.getRolePermissionSearchRoleMenuButton(rolecode || res[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉 + + await this.getRolePermissionSearchRoleMenu(rolecode || res[0].code)// 鐢ㄤ簬娓叉煋椤甸潰 + } else { + this.$notify.error('璇峰厛寤虹浉瀵瑰簲鐨勮鑹诧紒') + } + }, + async tabClick() { + this.treeCenter = [] + await this.getRolePermissionSearchRoleMenuButton(this.$refs.treeLeftRef.getCurrentKey())// 鐢ㄤ簬鏁版嵁鍥炴樉 + await this.getRolePermissionSearchRoleMenu(this.$refs.treeLeftRef.getCurrentKey())// 鐢ㄤ簬娓叉煋椤甸潰 + }, + + // 鑾峰彇鑿滃崟鏉冮檺瀵瑰簲鐨勬寜閽� + async getRolePermissionSearchRoleMenuButton(rolecode) { + const { data: res } = await RolePermissionSearchRoleMenuButton({ rolecode, type: this.activeName }) + this.allButtonData = res.length > 0 ? JSON.parse(res[0].jsondate) : [] + }, + // 鑾峰彇鑿滃崟鏉冮檺 + async getRolePermissionSearchRoleMenu(rolecode) { + const { data: res } = await RolePermissionSearchRoleMenu({ rolecode, type: this.activeName }) + + // 鎷垮埌鏁扮粍list杞崲鎴愭爲褰ree + const result = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'menucode', + childrenProperty: 'children' + }) + + this.treeCenter = [ + { menucode: '-1', menuname: '鍏ㄩ儴', children: result } + ] + + this.treeCenter[0].children.sort((a, b) => a.menu_seq - b.menu_seq) + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + it.buttoncodelist = it.buttoncodelist !== '' && it.buttoncodelist !== null ? it.buttoncodelist.split(',') : [] + if (it.buttoncodelist && it.buttoncodelist.length > 0) { + it.buttoncodelist = this.ButtonData.filter(j => + it.buttoncodelist.includes(j.buttoncode) + ) + + it.buttoncodelist = it.buttoncodelist.map(j => j.buttonname) + } + }) + + item.children.sort((a, b) => a.menu_seq - b.menu_seq) + + item.expanded = true + } + }) + + this.handleData()// 澶勭悊鏁版嵁鍥炴樉 + }, + // 澶勭悊缁勫悎鏁版嵁 + handleData() { + this.menuCheckedCodeArr = this.allButtonData.map(i => i.menucode) + this.$nextTick(() => { + if (this.activeName === 'PC') { + this.$refs.treeCenterPCRef.setCheckedKeys(this.menuCheckedCodeArr) + } + if (this.activeName === 'APP') { + this.$refs.treeCenterAPPRef.setCheckedKeys(this.menuCheckedCodeArr) + } + }) + + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : [] + temp = temp.length > 0 ? temp.split(',') : [] + it.buttonChecked = [] // 鏁版嵁鍥炴樉 + this.ButtonData.forEach(j => { + if (temp.includes(j.buttoncode)) { + it.buttonChecked.push(j.buttonname) + } + }) + }) + } + }) + + this.handleCheckedButtonChange('', '', '', true) + // this.$forceUpdate() + }, + + // 宸﹁竟婊氬姩鏉℃粦鍔ㄦ椂 + scrollLeftScroll() { + if (this.isScroll === 'left') { + this.$refs.scrollCenter.scrollTop = this.$refs.scrollLeft.scrollTop + } + }, + // 涓棿杈规粴鍔ㄦ潯婊戝姩鏃� + scrollCenterScroll() { + if (this.isScroll === 'center') { + this.$refs.scrollLeft.scrollTop = this.$refs.scrollCenter.scrollTop + } + }, + + // 鍏ㄩ�夋敼鍙� + handleCheckAllChange(val) { + let checkedKeys + if (this.activeName === 'PC') { + checkedKeys = this.$refs.treeCenterPCRef.getCheckedKeys() + } + if (this.activeName === 'APP') { + checkedKeys = this.$refs.treeCenterAPPRef.getCheckedKeys() + } + + if (val) { + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (checkedKeys.includes(it.menucode)) { + it.buttonChecked = it.buttoncodelist + } + }) + } + }) + } else { + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (checkedKeys.includes(it.menucode)) { + it.buttonChecked = [] + } + }) + } + }) + } + }, + // 鍗曚釜鎸夐挳鏀瑰彉 + handleCheckedButtonChange(oldValue, code, newValue, flag) { + // console.log(oldValue, code, newValue, 2) + // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴 + if (!flag) { + if (!this.menuCheckedCodeArr.includes(code) && oldValue.length === 0 && newValue.length === 1) { // 鍚� + this.menuCheckedCodeArr.push(code) + } else if (this.menuCheckedCodeArr.includes(code) && oldValue.length === 1 && newValue.length === 0) { // 鏄� + this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== code) + } + if (this.activeName === 'PC') { + this.$refs.treeCenterPCRef.setCheckedKeys(this.menuCheckedCodeArr) + } + if (this.activeName === 'APP') { + this.$refs.treeCenterAPPRef.setCheckedKeys(this.menuCheckedCodeArr) + } + } + + // 杩欓噷鏄垽鏂叏閫塩heckbox 鏄惁閫変腑 + let count = 0 + let childrenLength = 0 + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (it.buttonChecked && it.buttonChecked.length === it.buttoncodelist.length && it.buttoncodelist.length > 0) { + count++ + } + + if (it.buttoncodelist.length) { + childrenLength++ + } + }) + } + }) + + this.buttonIsChecked = count === childrenLength + this.$forceUpdate() + }, + // 鑾峰彇鏍戝舰鑺傜偣node + getLeftTreeNode(data, Node, VueComponent) { + this.treeCenter[0].children.forEach(item => { + if (item.menucode === data.menucode) { + item.expanded = Node.expanded + } + }) + if (data.menucode === '-1') { + Node.expanded = true // 鏆傛椂鍏堝啓鎴愯繖涓� + } + this.$forceUpdate() + }, + // 澶勭悊涓棿鏍戝舰鍕鹃�� + handleTreeCenterCheck(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { + // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, '鍔犲瀹�') + + if (checkedKeys.length === 0) { // 鏍戝舰鑿滃崟鍏ㄤ笉閫夌殑鎯呭喌涓� + this.buttonIsChecked = false + this.menuCheckedCodeArr = [] + } else { + if (checkedKeys.includes(obj.menucode)) { // 鍒ゆ柇鏄惁鍖呭惈鍦ㄥ唴 //鏄� + this.menuCheckedCodeArr.push(obj.menucode) + } else { // 鍚� + this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode) + } + } + }, + // 澶勭悊涓棿鏍戝舰閫変腑鍊兼敼鍙� + handleTreeCenterCheckChange(obj, selfChecked, selfChildrenTreeCheck) { + // console.log(obj, selfChecked, selfChildrenTreeCheck, '鐜嬭�佸悏') + if (!selfChildrenTreeCheck) { + if (!selfChecked) { // 浠庨�変腑鍒颁笉閫変腑 + obj.buttonChecked = [] + this.menuCheckedCodeArr = this.menuCheckedCodeArr.filter(i => i !== obj.menucode) + } + if (selfChecked) { // 浠庝笉閫変腑鍒伴�変腑 + obj.buttonCheckedCode = [] + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (it.menucode === obj.menucode) { + this.menuCheckedCodeArr.push(obj.menucode) + } + }) + } + }) + } + + this.$forceUpdate() + } + }, + // 瑙掕壊鍒囨崲 + async treeLeftNodeClick(obj, Node, VueComponent) { + if (obj.code !== '000') { + await this.getRolePermissionSearchRoleMenuButton(obj.code) + this.handleData() + } + }, + // 椤甸潰鍕鹃�夊ソ淇濆瓨浜嬩欢 + async saveClick() { + const rolecode = this.$refs.treeLeftRef.getCurrentKey() + const datacode = this.treeLeft.find(i => i.code === rolecode).datarange !== 'CUSTOM' ? this.treeLeft.find(i => i.code === rolecode).datarange : this.treeLeft.find(i => i.code === rolecode).datapermissions + let menuKeyArr + if (this.activeName === 'PC') { + menuKeyArr = this.$refs.treeCenterPCRef.getCheckedKeys() + } + if (this.activeName === 'APP') { + menuKeyArr = this.$refs.treeCenterAPPRef.getCheckedKeys() + } + + const arr = [] + this.treeCenter[0].children.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (menuKeyArr.includes(it.menucode)) { + if (it.buttonChecked && it.buttonChecked.length > 0) { // 宸查�夎彍鍗� + it.buttonCheckedCode = this.ButtonData.filter(i => + it.buttonChecked.includes(i.buttonname) + ).map(i => i.buttoncode) + } + arr.push({ + menucode: it.menucode, + datacode, + buttoncode: it.buttonCheckedCode ? it.buttonCheckedCode.join(',') : '' + }) + } + }) + } + }) + this.$store.state.app.buttonIsDisabled = true + + const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName) + if (res.code === '200') { + const rolename = this.treeLeft.find(i => i.code === rolecode).name + this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒') + await this.getRolePermissionSearchRoleMenuButton(rolecode) + this.$store.state.app.buttonIsDisabled = false + } + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 50 + }) + }, + // 宸︿晶鏍戝舰鎷栧姩澶勭悊 + treeLeftAllowDrop(draggingNode, dropNode, type) { + // console.log(draggingNode, dropNode, type) + // 娉ㄦ帀鐨勬槸鍚岀骇鎷栨嫿 + if (draggingNode.level === dropNode.level) { + return type === 'prev' || type === 'next' + } else { + // 涓嶅悓绾ц繘琛屽鐞� + return false + } + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-checkbox__label { + width: 55px; +} + +.el-checkbox-group { + margin-left: 0 !important; + padding-left: 40px; +} + +.el-checkbox-group:hover { + background: #f0f7ff; +} +</style> diff --git a/src/views/basicSettings/processList.vue b/src/views/basicSettings/processList.vue index 2d85c8d..c98330c 100644 --- a/src/views/basicSettings/processList.vue +++ b/src/views/basicSettings/processList.vue @@ -1,434 +1,439 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=15')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宸ュ簭缂栫爜" style=" display: flex;"> - <el-input v-model="form.stepcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ュ簭绫诲瀷" style=" display: flex;"> - <el-select - v-model="form.steptypecode" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in steptypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鐘舵��" style=" display: flex;"> - <el-select - v-model="form.enable" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in enableArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getStepSearch">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="flwtype" - label="宸ュ簭绫诲瀷" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.flwtype==='Z'?'鑷埗':'澶栧崗' }} - </template> - </el-table-column> - <el-table-column - prop="enable" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.enable==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.enable==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - prop="descr" - label="鎻忚堪" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.descr?row.descr:'/' }} - </template> - </el-table-column> - <el-table-column - prop="lm_user" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getStepSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="宸ュ簭缂栫爜" prop="stepcode"> - <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ュ簭鍚嶇О" prop="stepname"> - <el-input v-model="dialogForm.stepname" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ュ簭绫诲瀷" required> - <el-select - v-model="dialogForm.steptypecode" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in steptypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.enable"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="鎻忚堪"> - <el-input - v-model="dialogForm.description" - type="textarea" - style="width: 200px" - /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateStep, DeleteStep, StepSearch } from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' - -export default { - name: 'ProcessList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - stepcode: '', // - stepname: '', // - enable: '', // - steptypecode: '', // 宸ュ簭绫诲瀷 - prop: 'stepcode', // 鎺掑簭瀛楁 - order: 'asc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - steptypeArr: [ - { code: 'Z', name: '鑷埗' }, - { code: 'W', name: '澶栧崗' } - ], - enableArr: [ - { code: 'Y', name: '姝e父' }, - { code: 'N', name: '鍋滅敤' } - ], - dialogVisible: false, - dialogForm: { - id: '', - stepcode: '', // - stepname: '', // - steptypecode: 'Z', - description: '', // 鎻忚堪 - enable: 'Y'// 鐘舵�� - }, - operation: '', - dialogFormRules: { - stepcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - stepname: [ - { required: true, message: '璇疯緭鍏ュ伐搴忓悕绉�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getStepSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getStepSearch() { - const res = await StepSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getStepSearch() - }, - // 閲嶇疆 - reset() { - this.form.stepcode = '' - this.form.stepname = '' - this.form.enable = '' - this.form.steptypecode = '' - this.getStepSearch() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - this.dialogForm.id = row.id - this.dialogForm.stepcode = row.stepcode - this.dialogForm.stepname = row.stepname - this.dialogForm.description = row.descr - this.dialogForm.enable = row.enable - this.dialogForm.steptypecode = row.flwtype - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteStep({ stepcode: row.stepcode }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getStepSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.stepcode = '' - this.dialogForm.stepname = '' - this.dialogForm.id = '' - this.dialogForm.enable = 'Y' - this.dialogForm.description = '' - this.dialogForm.steptypecode = 'Z' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - // console.log(JSON.parse(JSON.stringify(this.dialogForm))) - this.$store.state.app.buttonIsDisabled = true - AddUpdateStep(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getStepSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=15')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宸ュ簭缂栫爜" style=" display: flex;"> + <el-input v-model="form.stepcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ュ簭绫诲瀷" style=" display: flex;"> + <el-select + v-model="form.steptypecode" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in steptypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鐘舵��" style=" display: flex;"> + <el-select + v-model="form.enable" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in enableArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getStepSearch">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="flwtype" + label="宸ュ簭绫诲瀷" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.flwtype==='Z'?'鑷埗':'澶栧崗' }} + </template> + </el-table-column> + <el-table-column + prop="enable" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.enable==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.enable==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + prop="descr" + label="鎻忚堪" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.descr?row.descr:'/' }} + </template> + </el-table-column> + <el-table-column + prop="lm_user" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getStepSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="宸ュ簭缂栫爜" prop="stepcode"> + <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ュ簭鍚嶇О" prop="stepname"> + <el-input v-model="dialogForm.stepname" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ュ簭绫诲瀷" required> + <el-select + v-model="dialogForm.steptypecode" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in steptypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.enable"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input + v-model="dialogForm.description" + type="textarea" + style="width: 200px" + /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateStep, DeleteStep, StepSearch } from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' + +export default { + name: 'ProcessList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + stepcode: '', // + stepname: '', // + enable: '', // + steptypecode: '', // 宸ュ簭绫诲瀷 + prop: 'stepcode', // 鎺掑簭瀛楁 + order: 'asc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + steptypeArr: [ + { code: 'Z', name: '鑷埗' }, + { code: 'W', name: '澶栧崗' } + ], + enableArr: [ + { code: 'Y', name: '姝e父' }, + { code: 'N', name: '鍋滅敤' } + ], + dialogVisible: false, + dialogForm: { + id: '', + stepcode: '', // + stepname: '', // + steptypecode: 'Z', + description: '', // 鎻忚堪 + enable: 'Y'// 鐘舵�� + }, + operation: '', + dialogFormRules: { + stepcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + stepname: [ + { required: true, message: '璇疯緭鍏ュ伐搴忓悕绉�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getStepSearch() + }, + created() { + this.getStepSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getStepSearch() { + const res = await StepSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getStepSearch() + }, + // 閲嶇疆 + reset() { + this.form.stepcode = '' + this.form.stepname = '' + this.form.enable = '' + this.form.steptypecode = '' + this.getStepSearch() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + this.dialogForm.id = row.id + this.dialogForm.stepcode = row.stepcode + this.dialogForm.stepname = row.stepname + this.dialogForm.description = row.descr + this.dialogForm.enable = row.enable + this.dialogForm.steptypecode = row.flwtype + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteStep({ stepcode: row.stepcode }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getStepSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.stepcode = '' + this.dialogForm.stepname = '' + this.dialogForm.id = '' + this.dialogForm.enable = 'Y' + this.dialogForm.description = '' + this.dialogForm.steptypecode = 'Z' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + // console.log(JSON.parse(JSON.stringify(this.dialogForm))) + this.$store.state.app.buttonIsDisabled = true + AddUpdateStep(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getStepSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/processRoute.vue b/src/views/basicSettings/processRoute.vue index 8803191..e279397 100644 --- a/src/views/basicSettings/processRoute.vue +++ b/src/views/basicSettings/processRoute.vue @@ -1,1019 +1,1024 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宸ヨ壓璺嚎缂栫爜" style=" display: flex;"> - <el-input v-model="form.routecode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ヨ壓鍚嶇О" style=" display: flex;"> - <el-input v-model="form.routename" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="宸ヨ壓鎻忚堪" style=" display: flex;"> - <el-input v-model="form.description" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;"> - <el-input v-model="form.createuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - :height="tableHeight" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='enable'"> - <div v-if="row[item.prop]==='Y'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鏄� - </div> - <div v-if="row[item.prop]==='N'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 鍚� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <!-- <el-table-column--> - <!-- type="selection"--> - <!-- width="50"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="RowNum"--> - <!-- width="50"--> - <!-- label="搴忓彿"--> - <!-- fixed--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="code"--> - <!-- label="缂栫爜"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="name"--> - <!-- show-tooltip-when-overflow--> - <!-- label="鍚嶇О"--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="description"--> - <!-- label="宸ヨ壓璺嚎鎻忚堪"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.description">{{ row.description }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="enable"--> - <!-- show-tooltip-when-overflow--> - <!-- label="浣跨敤鐘舵��"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.enable==='Y'">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- 鏄�--> - <!-- </div>--> - <!-- <div v-if="row.enable==='N'">--> - <!-- <i class="el-icon-info" style="margin-right: 2px" />--> - <!-- 鍚�--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="lm_user"--> - <!-- show-tooltip-when-overflow--> - <!-- label="鍒涘缓浜哄憳"--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="lm_date"--> - <!-- label="鍒涘缓鏃堕棿"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- width="160"--> - <!-- />--> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="棰勮" placement="top"> - <i - class="el-icon-view" - :style="{color:$store.state.settings.theme}" - style="margin-right:15px;cursor: pointer;" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" style="margin-right:15px;" @click="del(row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="澶嶅埗" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-document-copy" style="cursor: pointer;color:#42b983" @click="copy('copy',row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getRouteSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':(operation==='edit'?'棰勮':'澶嶅埗')" - :visible.sync="dialogVisible" - width="1000px" - :close-on-click-modal="false" - :top="isIpad?'5vh':'15vh'" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" style="height: 500px" :rules="dialogFormRules" :model="dialogForm" label-width="110px"> - <div style="display: flex"> - <el-form-item label="宸ヨ壓璺嚎缂栫爜" prop="code" style="margin-right: 20px"> - <el-input v-model="dialogForm.code" :disabled="operation==='edit'" style="width: 220px" /> - </el-form-item> - <el-form-item label="宸ヨ壓鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" :disabled="operation==='edit'" style="width: 220px" /> - </el-form-item> - </div> - <div style="display: flex"> - <el-form-item prop="enable" label="浣跨敤鐘舵��" style="margin-right: 20px"> - <el-select - v-model="dialogForm.enable" - filterable - :disabled="operation==='edit'" - :popper-append-to-body="false" - style="width: 220px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in isEnableArr" - :key="item.value" - :label="item.label" - :value="item.value" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ヨ壓鎻忚堪" prop="description"> - <el-input - v-model="dialogForm.description" - :disabled="operation==='edit'" - type="textarea" - style="width: 220px" - /> - </el-form-item> - </div> - <el-form-item label="宸ヨ壓璁剧疆" prop="Data" style="margin-top: 30px"> - <div class="settingDiv"> - <!-- 瀹炵幇宸ヨ壓璁剧疆鍔ㄦ�佹坊鍔�--> - <div v-for="(tag,index) in dynamicTags" :key="tag.seq" style="display: flex;align-items: center"> - <div style="display: flex;align-items: center;position: relative;"> - <div - class="orderNumber" - :style="{ - backgroundColor:index===0?'#f8f8fa':'#409EFF', - color:index===0?'#c6bbc4':'#FFFFFF', - border:index===0?'1px solid #c6bbc4':'1px solid #409EFF', - zIndex:tag.label===selectedName?0:2 - }" - > - {{ index + 1 }} - </div> - - <!-- <el-tooltip--> - <!-- class="item"--> - <!-- effect="dark"--> - <!-- :content="tag.stepname"--> - <!-- placement="top"--> - <!-- >--> - <!-- @close="handleTagClose(tag.stepname)"--> - <!-- :closable="index!==0"--> - - <el-tag - v-if="tag.stepname!==selectedName" - :disable-transitions="false" - class="elTag" - :effect="tag.effect" - @click="elTagClick(tag)" - > - {{ tag.stepname }} - <i - v-if="tag.editDisabled&&operation!=='edit'" - class="el-icon-edit" - @click="tagEdit(tag)" - /> - </el-tag> - <!-- </el-tooltip>--> - <!-- {{ tag.editDisabled }}--> - <!-- left:tag.stepname===selectedName?'191px':'141px',--> - <i - v-if="index!==0&&tag.editDisabled&&operation!=='edit'" - :style="{ - top:tag.stepname===selectedName?'-2px':'-8px', - }" - class="el-icon-close" - @click="handleTagClose(tag)" - /> - <el-autocomplete - v-if="tag.stepname===selectedName" - :ref="'saveTagInput'+tag.seq" - v-model="autocompleteValue" - class="input-new-tag" - size="small" - :fetch-suggestions="querySearch" - style="margin-left: 0;width: 150px;transform: translate(1)" - autofocus - :debounce="300" - :popper-append-to-body="false" - popper-class="autocompleteClass" - @select="val=>handleSelect(val,tag)" - @keyup.enter.native="handleInputConfirm(tag)" - /> - <!-- @keyup.enter.native="handleInputConfirm(tag)"--> - - <!-- @blur="handleBlur2"--> - <div - v-if="index!==dynamicTags.length-1" - style="width: 40px;height: 1px;border: 1px solid #42b983" - /> - </div> - </div> - - <el-button - v-if="operation!=='edit'" - v-waves - type="success" - :disabled="addDisabled" - class="tagSuccess" - size="small" - icon="el-icon-plus" - @click="showInput" - /> - - </div> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-if="operation==='edit'" v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - <el-button v-if="operation!=='edit'" v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-if="operation!=='edit'" - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateRoute, DeleteRoute, RouteSearch, StepSelect, ViewRoute } from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'ProcessRoute', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - isIpad: false, - mainHeight: 0, - tableHeight: 0, - form: { - routecode: '', // 宸ヨ壓璺嚎缂栫爜 - routename: '', // 宸ヨ壓璺嚎鍚嶇О - description: '', // 宸ヨ壓璺嚎鎻忚堪 - createuser: '', // 鍒涘缓浜哄憳 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - isEnableArr: [ - { label: '鏄�', value: 'Y' }, - { label: '鍚�', value: 'N' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '宸ヨ壓璺嚎鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'enable', - label: '浣跨敤鐘舵��', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 160, - width: false, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 8, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - dialogForm: { - id: '', - code: '', - name: '', - enable: 'Y', - description: '', - Data: [] - }, - dynamicTags: [// 宸ヨ壓璁剧疆鏁扮粍 - { editDisabled: true, stepcode: '', seq: 1, stepname: ' ', effect: 'light' } - // { editDisabled: true, stepcode: 'Step02', seq: 2, stepname: '濂�', effect: 'light' }, - // { editDisabled: true, stepcode: 'Step03', seq: 3, stepname: '澶�', effect: 'light' } - ], - clickSelected: '', // 榧犳爣鐐瑰嚮閫変腑鐨勫�� - selectedName: '', // 閫変腑鐨勫悕绉� - autocompleteValue: '', // 鍙悳绱㈣緭鍏ユ涓殑鍊� - routeArr: [], // 宸ヨ壓璁剧疆涓嬫媺鎵�鏈夊�� - routeSelectedArr: [], // 宸ヨ壓璁剧疆涓嬫媺宸查�夌殑鍊� - addDisabled: true, // 娣诲姞鎸夐挳鏄惁鍙偣鍑� - // editDisabled: true, // 淇敼鎸夐挳鏄惁鍙偣鍑� - mouseFocusPosition: 0, // 榧犳爣鑱氱劍鐨勪綅缃� - operation: '', - dialogFormRules: { - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ], - enable: [ - { required: true, message: '璇烽�夋嫨浣跨敤鐘舵��', trigger: ['blur', 'change'] } - ] - // Data: [ - // { required: true, message: '璇疯缃伐鑹�', trigger: ['blur', 'change'] } - // ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getRouteSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - // 杩滅▼鎼滅储 - querySearch(queryString, cb) { - const routeArr = this.routeArr - routeArr.forEach(item => { - item.value = item.stepname - }) - const results = queryString ? routeArr.filter(this.createFilter(queryString)) : routeArr - // 璋冪敤 callback 杩斿洖寤鸿鍒楄〃鐨勬暟鎹� - cb(results) - }, - // 杩囨护 - createFilter(queryString) { - return (res) => { - return (res.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1) - } - }, - // 宸ヨ壓璁剧疆 涓嬫媺鑾峰彇鎵�鏈� - async getStepSelectArr() { - const { data: res } = await StepSelect() - this.routeArr = res - }, - // 澶勭悊涓嬫媺閫夋嫨 - handleSelect(item, tag) { - this.autocompleteValue = item.value - this.$nextTick(_ => { - this.$refs['saveTagInput' + this.mouseFocusPosition][0].focus() - this.handleInputConfirm(tag) - }) - }, - // 杈撳叆妗嗙‘璁や簨浠� - handleInputConfirm(tag) { - // 1.閫夋嫨鍐呭涓嶈兘涓虹┖ - if (this.autocompleteValue.trim().length < 1) { - return this.$message.info('閫夋嫨鍐呭涓嶈兘涓虹┖锛�') - } - // 2.杈撳叆妗嗗唴瀹逛笌涓嬫媺閫夐」鍐呭涓嶅尮閰� - let flag = false - this.routeArr.forEach(item => { - if (item.stepname === this.autocompleteValue) { - flag = true - } - }) - if (!flag) { - return this.$message.info('杈撳叆妗嗗唴瀹逛笌涓嬫媺閫夐」鍐呭涓嶅尮閰嶏紒') - } - - // 3.杈撳叆妗嗗唴瀹逛笌宸查�夊唴瀹圭浉鍚屾椂涓嶈兘淇濆瓨 - let flag2 = false - this.dynamicTags.forEach(item => { - if (item.stepname === this.autocompleteValue.trim()) { - flag2 = true - } - }) - if (tag.stepname === this.autocompleteValue.trim()) { - flag2 = false - } - if (flag2) { - return this.$message.info('姝ゅ伐搴忓凡閫夛紝璇烽�夋嫨鍏跺畠宸ュ簭锛�') - } - - this.routeArr.forEach((item, index) => { - if (this.autocompleteValue.trim() === item.stepname) { - this.routeSelectedArr.push({ - stepcode: item.stepcode, - stepname: item.stepname, - value: item.value - }) - - this.routeArr.splice(index, 1) - } - }) - - // 灏嗗�兼浛鎹㈠埌鍘焧ag浣嶇疆涓� - this.dynamicTags.forEach((item, index) => { - if ((index + 1) === tag.seq) { - item.stepname = this.autocompleteValue - item.effect = 'dark' - } - item.editDisabled = true - }) - this.clickSelected = this.dynamicTags.findIndex(i => i.effect === 'dark') + 1 - - this.addDisabled = false - this.editDisabled = true - this.selectedName = '' - }, - // tag鐐瑰嚮淇敼鎸夐挳 - tagEdit(tag) { - this.autocompleteValue = '' - this.dynamicTags.forEach(item => { - item.stepname = item.stepname.trim() - item.editDisabled = false - if (item.seq !== tag.seq) { - item.effect = 'light' - } else { - item.effect = 'dark' - } - }) - - if (tag.stepname !== '') { - const routeSelectedArr = this.routeSelectedArr.find(item => item.stepname === tag.stepname) - - this.routeArr.push( - { - stepcode: routeSelectedArr.stepcode, - stepname: routeSelectedArr.stepname, - value: routeSelectedArr.value - } - ) - } - - this.addDisabled = true - this.selectedName = tag.stepname - this.autocompleteValue = tag.stepname - this.$nextTick(_ => { - this.$refs['saveTagInput' + tag.seq][0].focus() - }) - this.mouseFocusPosition = tag.seq - }, - // tag鐐瑰嚮浜嬩欢 - elTagClick(tag) { - if (this.dynamicTags.every(i => i.editDisabled)) { - this.clickSelected = tag.seq - if (tag.effect === 'dark') { - - } else { - this.dynamicTags.forEach(item => { - item.effect = 'light' - }) - if (tag.effect === 'light') { - tag.effect = 'dark' - } else if (tag.effect === 'dark') { - tag.effect = 'light' - } - } - } - }, - // 澶勭悊tag鍏抽棴浜嬩欢 - handleTagClose(tag) { - // 褰撻�変腑鐨勬楠よ鍒犻櫎鏃� - if (tag.effect === 'dark') { - this.clickSelected = this.dynamicTags.length - 1 - } - this.dynamicTags.forEach((item, index) => { - if (item.seq === tag.seq) { - this.dynamicTags.splice(index, 1) - } - }) - - const routeSelectedArr = this.routeSelectedArr.find(item => item.stepname === tag.stepname) - - if (routeSelectedArr !== undefined) { - this.routeArr.push( - { - stepcode: routeSelectedArr.stepcode, - stepname: routeSelectedArr.stepname, - value: routeSelectedArr.value - } - ) - } - this.routeArr = this.routeArr.filter((currentValue, currentIndex, selfArr) => { - return selfArr.findIndex(item => item.stepcode === currentValue.stepcode) === currentIndex - }) - - // 閲嶆柊鎺掑簭 - this.dynamicTags.forEach((item, index) => { - item.editDisabled = true - item.seq = index + 1 - item.stepcode = '' - item.effect = index === this.dynamicTags.length - 1 ? 'dark' : 'light' - }) - this.addDisabled = false - }, - // tag娣诲姞鎸夐挳 - showInput() { - const seq = this.dynamicTags.findIndex(i => i.effect === 'dark') + 2 - - // 鍏堝皢姣忎釜鐨則ag鏍囩棰滆壊鏀逛负娴呰壊 - this.dynamicTags.forEach(i => { - i.effect = 'light' - }) - - this.autocompleteValue = '' - this.addDisabled = true - this.editDisabled = false - - this.dynamicTags.splice(this.clickSelected, 0, { editDisabled: true, seq: seq, stepname: '', effect: 'dark' }) - this.dynamicTags.forEach((item, index) => { - item.seq = index + 1 - item.stepcode = '' - }) - this.$nextTick(_ => { - this.$refs['saveTagInput' + seq][0].focus() - }) - - this.mouseFocusPosition = seq - - this.dynamicTags.forEach((item, index) => { - item.editDisabled = seq === index + 1 - }) - }, - - // 鑾峰彇宸ヨ壓璺嚎鍒楄〃娓呭崟 - async getRouteSearch() { - const res = await RouteSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getRouteSearch() - }, - // 鏌ヨ - search() { - this.getRouteSearch() - }, - upload() { - - }, - // 閲嶇疆 - reset() { - this.form.routecode = '' - this.form.routename = '' - this.form.description = '' - this.form.createuser = '' - this.getRouteSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.getStepSelectArr() - }, - // 宸ヨ壓璺嚎棰勮 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const { data: res } = await ViewRoute({ routecode: row.code }) - - this.dynamicTags = [] - this.$nextTick(() => { - this.dialogForm.code = res[0].code - this.dialogForm.name = res[0].name - this.dialogForm.enable = res[0].enable - this.dialogForm.description = res[0].description - // this.dialogForm.Data = row.description - res[0].Data.forEach(item => { - this.dynamicTags.push( - { seq: item.seq, stepname: item.stepname, stepcode: item.stepcode, editDisabled: true, effect: 'light' } - ) - }) - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteRoute({ routecode: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getRouteSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 澶嶅埗鎸夐挳 - async copy(operation, row) { - this.operation = operation - this.dialogVisible = true - - await this.getStepSelectArr() - const { data: res } = await ViewRoute({ routecode: row.code }) - // 寰呮敼 - this.dynamicTags = [] - this.routeSelectedArr = [] - this.$nextTick(() => { - this.dialogForm.code = res[0].code - this.dialogForm.name = res[0].name - this.dialogForm.enable = res[0].enable - this.dialogForm.description = res[0].description - res[0].Data.forEach((item, index) => { - this.dynamicTags.push( - { seq: item.seq, stepname: item.stepname, stepcode: item.stepcode, editDisabled: true, effect: index === res[0].Data.length - 1 ? 'dark' : 'light' } - ) - this.routeSelectedArr.push({ - stepcode: item.stepcode, - stepname: item.stepname, - value: item.stepname - }) - this.routeArr = this.routeArr.filter(i => i.stepcode !== item.stepcode) - }) - - this.addDisabled = false - this.clickSelected = this.dynamicTags.length - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.enable = 'Y' - this.dialogForm.description = '' - this.dialogForm.Data = [] - - this.dynamicTags = [ - { editDisabled: true, stepcode: '', seq: 1, stepname: ' ', effect: 'light' } - ] - this.addDisabled = true - this.routeSelectedArr = [] - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - if (this.dynamicTags[0].stepname.trim() === '') { - return this.$message.info('宸ヨ壓璁剧疆绗竴椤逛笉鑳戒负绌猴紒') - } - const Data = [] - this.dynamicTags.forEach(item => { - Data.push({ - seq: item.seq, - stepcode: this.routeSelectedArr.find(it => it.stepname === item.stepname).stepcode, - stepname: item.stepname - }) - }) - - Data.forEach(item => { - if (item.stepname === this.routeSelectedArr.find(it => it.stepname === item.stepname).stepname) { - item.stepcode = this.routeSelectedArr.find(it => it.stepname === item.stepname).stepcode - } - }) - - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - code: this.dialogForm.code, - name: this.dialogForm.name, - enable: this.dialogForm.enable, - description: this.dialogForm.description, - Data: Data - } - - AddUpdateRoute(this.dialogForm.id, this.operation === 'edit' ? 'Update' : 'Add', data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '澶嶅埗鎴愬姛锛�') - this.getRouteSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '澶嶅埗澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - if (window.innerHeight < 769) { - this.tableHeight = this.tableHeight - 40 - } - this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style lang="scss" scoped> -$main_color: #42b983; - -/* -瀹炵幇宸ヨ壓璁剧疆鍔ㄦ�佹坊鍔犳牱寮� -*/ - -.orderNumber { - margin-bottom: 31px; - position: absolute; - margin-left: -7px; - z-index: 2; - width: 16px; - height: 16px !important; - font-size: 12px; - text-align: center; - line-height: 15px; - color: #FFFFFF; - background-color: #409EFF; - border-radius: 50%; -} - -.el-icon-edit { - width: 16px; - height: 16px; - border-radius: 50%; - padding: 3px 0 0 3px; - margin-left: 5px; - cursor: pointer; - position: absolute; - right: 3px; - bottom: 8px; -} - -.el-icon-edit:hover { - background-color: #99a9bf; - color: #FFFFFF; -} - -.el-icon-close { - position: absolute; - top: -8px; - z-index: 2; - left: 141px; - cursor: pointer; - color: #FFFFFF; - border-radius: 50%; - background-color: #ff7474; - padding: 1px 0 0 1px; -} - -//.el-icon-close:hover { -// background-color: #99a9bf; -//} - -.el-tag--dark { - background-color: $main_color; - border-color: $main_color; -} - -.tagSuccess { - margin-left: 20px; - width: 100px; - height: 32px; - display: flex; - justify-content: center; - color: $main_color; -} - -::v-deep .el-button--success { - width: 40px !important; - background-color: #ecf5ff; - border-radius: 0; - color: $main_color; -} - -::v-deep .el-button--success:disabled { - background-color: #eeeeee; - color: $main_color; -} - -::v-deep .el-tag { - //height: 30px; - border-radius: 0; - border: 1px solid $main_color; -} - -::v-deep .el-input--small .el-input__inner { - border-radius: 0; -} - -.settingDiv { - display: flex; - width: 100%; - padding-left: 7px; - height: 56px; - overflow-x: scroll; - overflow-y: hidden; - align-items: center; - background: aliceblue; -} - -.elTag { - margin-left: 0; - width: 150px; - position: relative; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.autocompleteClass { - .el-autocomplete-suggestion li { - //color: red; - } -} -</style> - -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宸ヨ壓璺嚎缂栫爜" style=" display: flex;"> + <el-input v-model="form.routecode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ヨ壓鍚嶇О" style=" display: flex;"> + <el-input v-model="form.routename" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="宸ヨ壓鎻忚堪" style=" display: flex;"> + <el-input v-model="form.description" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;"> + <el-input v-model="form.createuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + :height="tableHeight" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='enable'"> + <div v-if="row[item.prop]==='Y'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鏄� + </div> + <div v-if="row[item.prop]==='N'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 鍚� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <!-- <el-table-column--> + <!-- type="selection"--> + <!-- width="50"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="RowNum"--> + <!-- width="50"--> + <!-- label="搴忓彿"--> + <!-- fixed--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="code"--> + <!-- label="缂栫爜"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="name"--> + <!-- show-tooltip-when-overflow--> + <!-- label="鍚嶇О"--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="description"--> + <!-- label="宸ヨ壓璺嚎鎻忚堪"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.description">{{ row.description }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="enable"--> + <!-- show-tooltip-when-overflow--> + <!-- label="浣跨敤鐘舵��"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.enable==='Y'">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- 鏄�--> + <!-- </div>--> + <!-- <div v-if="row.enable==='N'">--> + <!-- <i class="el-icon-info" style="margin-right: 2px" />--> + <!-- 鍚�--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="lm_user"--> + <!-- show-tooltip-when-overflow--> + <!-- label="鍒涘缓浜哄憳"--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="lm_date"--> + <!-- label="鍒涘缓鏃堕棿"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- width="160"--> + <!-- />--> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="棰勮" placement="top"> + <i + class="el-icon-view" + :style="{color:$store.state.settings.theme}" + style="margin-right:15px;cursor: pointer;" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" style="margin-right:15px;" @click="del(row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="澶嶅埗" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-document-copy" style="cursor: pointer;color:#42b983" @click="copy('copy',row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getRouteSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':(operation==='edit'?'棰勮':'澶嶅埗')" + :visible.sync="dialogVisible" + width="1000px" + :close-on-click-modal="false" + :top="isIpad?'5vh':'15vh'" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" style="height: 500px" :rules="dialogFormRules" :model="dialogForm" label-width="110px"> + <div style="display: flex"> + <el-form-item label="宸ヨ壓璺嚎缂栫爜" prop="code" style="margin-right: 20px"> + <el-input v-model="dialogForm.code" :disabled="operation==='edit'" style="width: 220px" /> + </el-form-item> + <el-form-item label="宸ヨ壓鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" :disabled="operation==='edit'" style="width: 220px" /> + </el-form-item> + </div> + <div style="display: flex"> + <el-form-item prop="enable" label="浣跨敤鐘舵��" style="margin-right: 20px"> + <el-select + v-model="dialogForm.enable" + filterable + :disabled="operation==='edit'" + :popper-append-to-body="false" + style="width: 220px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in isEnableArr" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ヨ壓鎻忚堪" prop="description"> + <el-input + v-model="dialogForm.description" + :disabled="operation==='edit'" + type="textarea" + style="width: 220px" + /> + </el-form-item> + </div> + <el-form-item label="宸ヨ壓璁剧疆" prop="Data" style="margin-top: 30px"> + <div class="settingDiv"> + <!-- 瀹炵幇宸ヨ壓璁剧疆鍔ㄦ�佹坊鍔�--> + <div v-for="(tag,index) in dynamicTags" :key="tag.seq" style="display: flex;align-items: center"> + <div style="display: flex;align-items: center;position: relative;"> + <div + class="orderNumber" + :style="{ + backgroundColor:index===0?'#f8f8fa':'#409EFF', + color:index===0?'#c6bbc4':'#FFFFFF', + border:index===0?'1px solid #c6bbc4':'1px solid #409EFF', + zIndex:tag.label===selectedName?0:2 + }" + > + {{ index + 1 }} + </div> + + <!-- <el-tooltip--> + <!-- class="item"--> + <!-- effect="dark"--> + <!-- :content="tag.stepname"--> + <!-- placement="top"--> + <!-- >--> + <!-- @close="handleTagClose(tag.stepname)"--> + <!-- :closable="index!==0"--> + + <el-tag + v-if="tag.stepname!==selectedName" + :disable-transitions="false" + class="elTag" + :effect="tag.effect" + @click="elTagClick(tag)" + > + {{ tag.stepname }} + <i + v-if="tag.editDisabled&&operation!=='edit'" + class="el-icon-edit" + @click="tagEdit(tag)" + /> + </el-tag> + <!-- </el-tooltip>--> + <!-- {{ tag.editDisabled }}--> + <!-- left:tag.stepname===selectedName?'191px':'141px',--> + <i + v-if="index!==0&&tag.editDisabled&&operation!=='edit'" + :style="{ + top:tag.stepname===selectedName?'-2px':'-8px', + }" + class="el-icon-close" + @click="handleTagClose(tag)" + /> + <el-autocomplete + v-if="tag.stepname===selectedName" + :ref="'saveTagInput'+tag.seq" + v-model="autocompleteValue" + class="input-new-tag" + size="small" + :fetch-suggestions="querySearch" + style="margin-left: 0;width: 150px;transform: translate(1)" + autofocus + :debounce="300" + :popper-append-to-body="false" + popper-class="autocompleteClass" + @select="val=>handleSelect(val,tag)" + @keyup.enter.native="handleInputConfirm(tag)" + /> + <!-- @keyup.enter.native="handleInputConfirm(tag)"--> + + <!-- @blur="handleBlur2"--> + <div + v-if="index!==dynamicTags.length-1" + style="width: 40px;height: 1px;border: 1px solid #42b983" + /> + </div> + </div> + + <el-button + v-if="operation!=='edit'" + v-waves + type="success" + :disabled="addDisabled" + class="tagSuccess" + size="small" + icon="el-icon-plus" + @click="showInput" + /> + + </div> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-if="operation==='edit'" v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + <el-button v-if="operation!=='edit'" v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-if="operation!=='edit'" + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateRoute, DeleteRoute, RouteSearch, StepSelect, ViewRoute } from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'ProcessRoute', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + isIpad: false, + mainHeight: 0, + tableHeight: 0, + form: { + routecode: '', // 宸ヨ壓璺嚎缂栫爜 + routename: '', // 宸ヨ壓璺嚎鍚嶇О + description: '', // 宸ヨ壓璺嚎鎻忚堪 + createuser: '', // 鍒涘缓浜哄憳 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + isEnableArr: [ + { label: '鏄�', value: 'Y' }, + { label: '鍚�', value: 'N' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '宸ヨ壓璺嚎鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'enable', + label: '浣跨敤鐘舵��', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 160, + width: false, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 8, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + dialogForm: { + id: '', + code: '', + name: '', + enable: 'Y', + description: '', + Data: [] + }, + dynamicTags: [// 宸ヨ壓璁剧疆鏁扮粍 + { editDisabled: true, stepcode: '', seq: 1, stepname: ' ', effect: 'light' } + // { editDisabled: true, stepcode: 'Step02', seq: 2, stepname: '濂�', effect: 'light' }, + // { editDisabled: true, stepcode: 'Step03', seq: 3, stepname: '澶�', effect: 'light' } + ], + clickSelected: '', // 榧犳爣鐐瑰嚮閫変腑鐨勫�� + selectedName: '', // 閫変腑鐨勫悕绉� + autocompleteValue: '', // 鍙悳绱㈣緭鍏ユ涓殑鍊� + routeArr: [], // 宸ヨ壓璁剧疆涓嬫媺鎵�鏈夊�� + routeSelectedArr: [], // 宸ヨ壓璁剧疆涓嬫媺宸查�夌殑鍊� + addDisabled: true, // 娣诲姞鎸夐挳鏄惁鍙偣鍑� + // editDisabled: true, // 淇敼鎸夐挳鏄惁鍙偣鍑� + mouseFocusPosition: 0, // 榧犳爣鑱氱劍鐨勪綅缃� + operation: '', + dialogFormRules: { + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ], + enable: [ + { required: true, message: '璇烽�夋嫨浣跨敤鐘舵��', trigger: ['blur', 'change'] } + ] + // Data: [ + // { required: true, message: '璇疯缃伐鑹�', trigger: ['blur', 'change'] } + // ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getRouteSearch() + }, + created() { + this.getRouteSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + // 杩滅▼鎼滅储 + querySearch(queryString, cb) { + const routeArr = this.routeArr + routeArr.forEach(item => { + item.value = item.stepname + }) + const results = queryString ? routeArr.filter(this.createFilter(queryString)) : routeArr + // 璋冪敤 callback 杩斿洖寤鸿鍒楄〃鐨勬暟鎹� + cb(results) + }, + // 杩囨护 + createFilter(queryString) { + return (res) => { + return (res.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1) + } + }, + // 宸ヨ壓璁剧疆 涓嬫媺鑾峰彇鎵�鏈� + async getStepSelectArr() { + const { data: res } = await StepSelect() + this.routeArr = res + }, + // 澶勭悊涓嬫媺閫夋嫨 + handleSelect(item, tag) { + this.autocompleteValue = item.value + this.$nextTick(_ => { + this.$refs['saveTagInput' + this.mouseFocusPosition][0].focus() + this.handleInputConfirm(tag) + }) + }, + // 杈撳叆妗嗙‘璁や簨浠� + handleInputConfirm(tag) { + // 1.閫夋嫨鍐呭涓嶈兘涓虹┖ + if (this.autocompleteValue.trim().length < 1) { + return this.$message.info('閫夋嫨鍐呭涓嶈兘涓虹┖锛�') + } + // 2.杈撳叆妗嗗唴瀹逛笌涓嬫媺閫夐」鍐呭涓嶅尮閰� + let flag = false + this.routeArr.forEach(item => { + if (item.stepname === this.autocompleteValue) { + flag = true + } + }) + if (!flag) { + return this.$message.info('杈撳叆妗嗗唴瀹逛笌涓嬫媺閫夐」鍐呭涓嶅尮閰嶏紒') + } + + // 3.杈撳叆妗嗗唴瀹逛笌宸查�夊唴瀹圭浉鍚屾椂涓嶈兘淇濆瓨 + let flag2 = false + this.dynamicTags.forEach(item => { + if (item.stepname === this.autocompleteValue.trim()) { + flag2 = true + } + }) + if (tag.stepname === this.autocompleteValue.trim()) { + flag2 = false + } + if (flag2) { + return this.$message.info('姝ゅ伐搴忓凡閫夛紝璇烽�夋嫨鍏跺畠宸ュ簭锛�') + } + + this.routeArr.forEach((item, index) => { + if (this.autocompleteValue.trim() === item.stepname) { + this.routeSelectedArr.push({ + stepcode: item.stepcode, + stepname: item.stepname, + value: item.value + }) + + this.routeArr.splice(index, 1) + } + }) + + // 灏嗗�兼浛鎹㈠埌鍘焧ag浣嶇疆涓� + this.dynamicTags.forEach((item, index) => { + if ((index + 1) === tag.seq) { + item.stepname = this.autocompleteValue + item.effect = 'dark' + } + item.editDisabled = true + }) + this.clickSelected = this.dynamicTags.findIndex(i => i.effect === 'dark') + 1 + + this.addDisabled = false + this.editDisabled = true + this.selectedName = '' + }, + // tag鐐瑰嚮淇敼鎸夐挳 + tagEdit(tag) { + this.autocompleteValue = '' + this.dynamicTags.forEach(item => { + item.stepname = item.stepname.trim() + item.editDisabled = false + if (item.seq !== tag.seq) { + item.effect = 'light' + } else { + item.effect = 'dark' + } + }) + + if (tag.stepname !== '') { + const routeSelectedArr = this.routeSelectedArr.find(item => item.stepname === tag.stepname) + + this.routeArr.push( + { + stepcode: routeSelectedArr.stepcode, + stepname: routeSelectedArr.stepname, + value: routeSelectedArr.value + } + ) + } + + this.addDisabled = true + this.selectedName = tag.stepname + this.autocompleteValue = tag.stepname + this.$nextTick(_ => { + this.$refs['saveTagInput' + tag.seq][0].focus() + }) + this.mouseFocusPosition = tag.seq + }, + // tag鐐瑰嚮浜嬩欢 + elTagClick(tag) { + if (this.dynamicTags.every(i => i.editDisabled)) { + this.clickSelected = tag.seq + if (tag.effect === 'dark') { + + } else { + this.dynamicTags.forEach(item => { + item.effect = 'light' + }) + if (tag.effect === 'light') { + tag.effect = 'dark' + } else if (tag.effect === 'dark') { + tag.effect = 'light' + } + } + } + }, + // 澶勭悊tag鍏抽棴浜嬩欢 + handleTagClose(tag) { + // 褰撻�変腑鐨勬楠よ鍒犻櫎鏃� + if (tag.effect === 'dark') { + this.clickSelected = this.dynamicTags.length - 1 + } + this.dynamicTags.forEach((item, index) => { + if (item.seq === tag.seq) { + this.dynamicTags.splice(index, 1) + } + }) + + const routeSelectedArr = this.routeSelectedArr.find(item => item.stepname === tag.stepname) + + if (routeSelectedArr !== undefined) { + this.routeArr.push( + { + stepcode: routeSelectedArr.stepcode, + stepname: routeSelectedArr.stepname, + value: routeSelectedArr.value + } + ) + } + this.routeArr = this.routeArr.filter((currentValue, currentIndex, selfArr) => { + return selfArr.findIndex(item => item.stepcode === currentValue.stepcode) === currentIndex + }) + + // 閲嶆柊鎺掑簭 + this.dynamicTags.forEach((item, index) => { + item.editDisabled = true + item.seq = index + 1 + item.stepcode = '' + item.effect = index === this.dynamicTags.length - 1 ? 'dark' : 'light' + }) + this.addDisabled = false + }, + // tag娣诲姞鎸夐挳 + showInput() { + const seq = this.dynamicTags.findIndex(i => i.effect === 'dark') + 2 + + // 鍏堝皢姣忎釜鐨則ag鏍囩棰滆壊鏀逛负娴呰壊 + this.dynamicTags.forEach(i => { + i.effect = 'light' + }) + + this.autocompleteValue = '' + this.addDisabled = true + this.editDisabled = false + + this.dynamicTags.splice(this.clickSelected, 0, { editDisabled: true, seq: seq, stepname: '', effect: 'dark' }) + this.dynamicTags.forEach((item, index) => { + item.seq = index + 1 + item.stepcode = '' + }) + this.$nextTick(_ => { + this.$refs['saveTagInput' + seq][0].focus() + }) + + this.mouseFocusPosition = seq + + this.dynamicTags.forEach((item, index) => { + item.editDisabled = seq === index + 1 + }) + }, + + // 鑾峰彇宸ヨ壓璺嚎鍒楄〃娓呭崟 + async getRouteSearch() { + const res = await RouteSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getRouteSearch() + }, + // 鏌ヨ + search() { + this.getRouteSearch() + }, + upload() { + + }, + // 閲嶇疆 + reset() { + this.form.routecode = '' + this.form.routename = '' + this.form.description = '' + this.form.createuser = '' + this.getRouteSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.getStepSelectArr() + }, + // 宸ヨ壓璺嚎棰勮 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const { data: res } = await ViewRoute({ routecode: row.code }) + + this.dynamicTags = [] + this.$nextTick(() => { + this.dialogForm.code = res[0].code + this.dialogForm.name = res[0].name + this.dialogForm.enable = res[0].enable + this.dialogForm.description = res[0].description + // this.dialogForm.Data = row.description + res[0].Data.forEach(item => { + this.dynamicTags.push( + { seq: item.seq, stepname: item.stepname, stepcode: item.stepcode, editDisabled: true, effect: 'light' } + ) + }) + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteRoute({ routecode: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getRouteSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 澶嶅埗鎸夐挳 + async copy(operation, row) { + this.operation = operation + this.dialogVisible = true + + await this.getStepSelectArr() + const { data: res } = await ViewRoute({ routecode: row.code }) + // 寰呮敼 + this.dynamicTags = [] + this.routeSelectedArr = [] + this.$nextTick(() => { + this.dialogForm.code = res[0].code + this.dialogForm.name = res[0].name + this.dialogForm.enable = res[0].enable + this.dialogForm.description = res[0].description + res[0].Data.forEach((item, index) => { + this.dynamicTags.push( + { seq: item.seq, stepname: item.stepname, stepcode: item.stepcode, editDisabled: true, effect: index === res[0].Data.length - 1 ? 'dark' : 'light' } + ) + this.routeSelectedArr.push({ + stepcode: item.stepcode, + stepname: item.stepname, + value: item.stepname + }) + this.routeArr = this.routeArr.filter(i => i.stepcode !== item.stepcode) + }) + + this.addDisabled = false + this.clickSelected = this.dynamicTags.length + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.enable = 'Y' + this.dialogForm.description = '' + this.dialogForm.Data = [] + + this.dynamicTags = [ + { editDisabled: true, stepcode: '', seq: 1, stepname: ' ', effect: 'light' } + ] + this.addDisabled = true + this.routeSelectedArr = [] + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + if (this.dynamicTags[0].stepname.trim() === '') { + return this.$message.info('宸ヨ壓璁剧疆绗竴椤逛笉鑳戒负绌猴紒') + } + const Data = [] + this.dynamicTags.forEach(item => { + Data.push({ + seq: item.seq, + stepcode: this.routeSelectedArr.find(it => it.stepname === item.stepname).stepcode, + stepname: item.stepname + }) + }) + + Data.forEach(item => { + if (item.stepname === this.routeSelectedArr.find(it => it.stepname === item.stepname).stepname) { + item.stepcode = this.routeSelectedArr.find(it => it.stepname === item.stepname).stepcode + } + }) + + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + code: this.dialogForm.code, + name: this.dialogForm.name, + enable: this.dialogForm.enable, + description: this.dialogForm.description, + Data: Data + } + + AddUpdateRoute(this.dialogForm.id, this.operation === 'edit' ? 'Update' : 'Add', data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '澶嶅埗鎴愬姛锛�') + this.getRouteSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '澶嶅埗澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + if (window.innerHeight < 769) { + this.tableHeight = this.tableHeight - 40 + } + this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style lang="scss" scoped> +$main_color: #42b983; + +/* +瀹炵幇宸ヨ壓璁剧疆鍔ㄦ�佹坊鍔犳牱寮� +*/ + +.orderNumber { + margin-bottom: 31px; + position: absolute; + margin-left: -7px; + z-index: 2; + width: 16px; + height: 16px !important; + font-size: 12px; + text-align: center; + line-height: 15px; + color: #FFFFFF; + background-color: #409EFF; + border-radius: 50%; +} + +.el-icon-edit { + width: 16px; + height: 16px; + border-radius: 50%; + padding: 3px 0 0 3px; + margin-left: 5px; + cursor: pointer; + position: absolute; + right: 3px; + bottom: 8px; +} + +.el-icon-edit:hover { + background-color: #99a9bf; + color: #FFFFFF; +} + +.el-icon-close { + position: absolute; + top: -8px; + z-index: 2; + left: 141px; + cursor: pointer; + color: #FFFFFF; + border-radius: 50%; + background-color: #ff7474; + padding: 1px 0 0 1px; +} + +//.el-icon-close:hover { +// background-color: #99a9bf; +//} + +.el-tag--dark { + background-color: $main_color; + border-color: $main_color; +} + +.tagSuccess { + margin-left: 20px; + width: 100px; + height: 32px; + display: flex; + justify-content: center; + color: $main_color; +} + +::v-deep .el-button--success { + width: 40px !important; + background-color: #ecf5ff; + border-radius: 0; + color: $main_color; +} + +::v-deep .el-button--success:disabled { + background-color: #eeeeee; + color: $main_color; +} + +::v-deep .el-tag { + //height: 30px; + border-radius: 0; + border: 1px solid $main_color; +} + +::v-deep .el-input--small .el-input__inner { + border-radius: 0; +} + +.settingDiv { + display: flex; + width: 100%; + padding-left: 7px; + height: 56px; + overflow-x: scroll; + overflow-y: hidden; + align-items: center; + background: aliceblue; +} + +.elTag { + margin-left: 0; + width: 150px; + position: relative; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.autocompleteClass { + .el-autocomplete-suggestion li { + //color: red; + } +} +</style> + +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/basicSettings/roleDivider.vue b/src/views/basicSettings/roleDivider.vue index 7213e22..b230dc2 100644 --- a/src/views/basicSettings/roleDivider.vue +++ b/src/views/basicSettings/roleDivider.vue @@ -1,555 +1,561 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="danger" icon="el-icon-error" @click="batchCancel">鎵归噺鍙栨秷鎺堟潈</el-button> - <!-- <el-button v-waves type="warning" icon="el-icon-close">鍏抽棴</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;"> - <el-select - v-model="form.role_code" - style="width:200px" - placeholder="璇烽�夋嫨" - @change="roleChange" - > - <el-option - v-for="item in roleArr" - :key="item.rolecode" - :label="item.rolename" - :value="item.rolecode" - /> - </el-select> - </el-form-item> - <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;"> - <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐢ㄦ埛鍚嶇О" style=" display: flex;"> - <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item label="缁勭粐缂栫爜" style=" display: flex;"> - <el-cascader - ref="cascader" - v-model="form.storg_code" - :options="cascaderOptions" - filterable - :props="defaultProps" - :show-all-levels="false" - /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="宀椾綅鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.post_code" - style="width:200px" - multiple - collapse-tags - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in postArr" - :key="item.postcode" - :label="item.postname" - :value="item.postcode" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐝粍缂栫爜" style=" display: flex;"> - <el-select - v-model="form.group_code" - style="width:200px" - multiple - collapse-tags - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in groupArr" - :key="item.usergroupcode" - :label="item.usergroupname" - :value="item.usergroupcode" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getRoleAssignedUserData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :row-key="getRowKey" - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @selection-change="handleSelectionChange" - @sort-change="sortChange" - > - <el-table-column - type="selection" - width="50" - :reserve-selection="true" - fixed - /> - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="usercode" - label="鐢ㄦ埛缂栫爜" - sortable="custom" - /> - <el-table-column - prop="username" - label="鐢ㄦ埛鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="storg_name" - label="鎵�灞炵粍缁�" - sortable="custom" - /> - <el-table-column - prop="rolename" - label="瑙掕壊" - show-overflow-tooltip - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.rolename ? row.rolename : '/' }} - </template> - </el-table-column> - <el-table-column - prop="postname" - label="宀椾綅" - sortable="custom" - show-overflow-tooltip - > - <template slot-scope="{row}"> - {{ row.postname ? row.postname : '/' }} - </template> - </el-table-column> - <el-table-column - prop="group_name" - label="鐝粍" - show-overflow-tooltip - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.group_name ? row.group_name : '/' }} - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - width="200" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button - type="text" - style="cursor: pointer;font-size: 14px" - @click="cancel(row.usercode)" - >鍙栨秷鎺堟潈 - </el-button> - - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getRoleAssignedUserData" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏂板" - :visible.sync="dialogVisible" - width="1200px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div> - <el-table - ref="tableDataDialogRef" - class="tableFixed" - :data="tableDataDialog" - row-class-name="custom-row" - - height="400" - border - :style="{width: 100+'%',height:'400px',}" - highlight-current-row - :row-key="getRowKey" - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @selection-change="handleDialogSelectionChange" - > - <el-table-column - type="selection" - width="50" - :reserve-selection="true" - fixed - /> - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="usercode" - label="鐢ㄦ埛缂栫爜" - /> - <el-table-column - prop="username" - label="鐢ㄦ埛鍚嶇О" - /> - <el-table-column - prop="storg_name" - label="鎵�灞炵粍缁�" - /> - <el-table-column - prop="rolename" - show-overflow-tooltip - label="瑙掕壊" - > - <template slot-scope="{row}"> - {{ row.rolename?row.rolename:'/' }} - </template> - </el-table-column> - <el-table-column - prop="postname" - label="宀椾綅" - show-overflow-tooltip - > - <template slot-scope="{row}"> - {{ row.postname?row.postname:'/' }} - </template> - </el-table-column> - <el-table-column - prop="group_name" - show-overflow-tooltip - label="鐝粍" - > - <template slot-scope="{row}"> - {{ row.group_name?row.group_name:'/' }} - </template> - </el-table-column> - </el-table> - <!--鍒嗛〉--> - <pagination - :total="totalDialog" - :page.sync="dialogForm.page" - :limit.sync="dialogForm.rows" - align="right" - style="margin-top: 10px;" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="add" - /> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button - v-waves - @click="dialogVisibleCancel" - >鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - RoleAssignedUserBatchAdd, - RoleAssignedUserBatchCancel, - RoleAssignedUserData -} from '@/api/basicSettings' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import arrayToTree from 'array-to-tree' -import { GroupsPermissions, PostPermissions, PrentOrganization, RolePermissions } from '@/api/GeneralBasicData' - -export default { - name: 'RoleDivider', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - flag: 'TRUE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�) - role_code: '', // 瑙掕壊缂栫爜 - usercode: '', // 鐢ㄦ埛缂栫爜 - username: '', // 鐢ㄦ埛鍚嶇О - storg_code: [], // - post_code: [], // - group_code: [], // - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - - cascaderOptions: [], - defaultProps: { - checkStrictly: true, - expandTrigger: 'hover', - value: 'torg_code', - label: 'torg_name' - }, - roleArr: [], - postArr: [], - groupArr: [], - - dialogVisible: false, - dialogForm: { - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - tableDataDialog: [], - totalDialog: 10, - - batchRoleCode: [], - batchDialogRoleCode: [] - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getAllSelectData() - this.getPrentOrganization() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getRoleAssignedUserData() { - if (window.location.hash.indexOf('?') !== -1) { - this.form.role_code = window.location.hash.split('?')[1].split('=')[1] - } - - if (!this.form.role_code) { - this.form.role_code = this.roleArr[0].rolecode - } - - this.form.storg_code = this.form.storg_code ? this.form.storg_code[this.form.storg_code.length - 1] : '' - this.form.post_code = this.form.post_code ? this.form.post_code.join(',') : '' - this.form.group_code = this.form.group_code ? this.form.group_code.join(',') : '' - - const res = await RoleAssignedUserData(this.form) - this.tableData = res.data - this.total = res.count - }, - async getPrentOrganization() { - const { data: res } = await PrentOrganization() - this.cascaderOptions = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'torg_code', - childrenProperty: 'children' - }) - }, - // 宀椾綅 瑙掕壊 鐝粍 - async getAllSelectData() { - const { data: res2 } = await RolePermissions() - this.roleArr = res2 - await this.getRoleAssignedUserData() - - const { data: res1 } = await PostPermissions() - this.postArr = res1 - - const { data: res3 } = await GroupsPermissions() - this.groupArr = res3 - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getRoleAssignedUserData() - }, - // 閲嶇疆 - reset() { - this.form.usercode = '' - this.form.username = '' - - this.form.storg_code = [] - this.form.post_code = [] - this.form.group_code = [] - this.getRoleAssignedUserData() - }, - roleChange(val) { - this.getRoleAssignedUserData() - this.batchRoleCode = [] - this.$refs.tableDataRef.clearSelection() - }, - - async cancel(code) { - // if (!this.form.role_code) { - // return this.$message.error('') - // } - - const res = await RoleAssignedUserBatchCancel([code], this.form.role_code) - if (res.code === '200') { - this.$notify.success('鍙栨秷鎺堟潈鎴愬姛锛�') - await this.getRoleAssignedUserData() - } else { - this.$notify.error('鍙栨秷鎺堟潈澶辫触锛�') - } - }, - - async batchCancel() { - const res = await RoleAssignedUserBatchCancel(this.batchRoleCode, this.form.role_code) - if (res.code === '200') { - this.$notify.success(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冩垚鍔燂紒') - await this.getRoleAssignedUserData() - this.batchRoleCode = [] - this.$refs.tableDataRef.clearSelection() - } else { - this.$notify.error(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冨け璐ワ紒') - } - }, - - // 鏂板鎸夐挳 - async add() { - this.dialogVisible = true - - const data = { - flag: 'FALSE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�) - role_code: this.form.role_code, // 瑙掕壊缂栫爜 - usercode: '', // 鐢ㄦ埛缂栫爜 - username: '', // 鐢ㄦ埛鍚嶇О - storg_code: '', // - post_code: '', // - group_code: '', // - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: this.dialogForm.page, // 绗嚑椤� - rows: this.dialogForm.rows // 姣忛〉澶氬皯鏉� - } - const res = await RoleAssignedUserData(data) - this.tableDataDialog = res.data - this.totalDialog = res.count - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - // this.form.flag = 'TRUE' - }, - getRowKey(row) { - return row.usercode - }, - handleSelectionChange(rows) { - this.batchRoleCode = rows.map(i => i.usercode) - }, - handleDialogSelectionChange(rows) { - this.batchDialogRoleCode = rows.map(i => i.usercode) - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - async dialogVisibleConfirm() { - const res = await RoleAssignedUserBatchAdd(this.batchDialogRoleCode, this.form.role_code) - if (res.code === '200') { - this.$notify.success(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冩垚鍔燂紒') - await this.getRoleAssignedUserData() - this.batchDialogRoleCode = [] - this.$refs.tableDataDialogRef.clearSelection() - this.dialogVisible = false - } else { - this.$notify.error(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冨け璐ワ紒') - } - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="danger" icon="el-icon-error" @click="batchCancel">鎵归噺鍙栨秷鎺堟潈</el-button> + <!-- <el-button v-waves type="warning" icon="el-icon-close">鍏抽棴</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;"> + <el-select + v-model="form.role_code" + style="width:200px" + placeholder="璇烽�夋嫨" + @change="roleChange" + > + <el-option + v-for="item in roleArr" + :key="item.rolecode" + :label="item.rolename" + :value="item.rolecode" + /> + </el-select> + </el-form-item> + <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;"> + <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐢ㄦ埛鍚嶇О" style=" display: flex;"> + <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item label="缁勭粐缂栫爜" style=" display: flex;"> + <el-cascader + ref="cascader" + v-model="form.storg_code" + :options="cascaderOptions" + filterable + :props="defaultProps" + :show-all-levels="false" + /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="宀椾綅鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.post_code" + style="width:200px" + multiple + collapse-tags + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in postArr" + :key="item.postcode" + :label="item.postname" + :value="item.postcode" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐝粍缂栫爜" style=" display: flex;"> + <el-select + v-model="form.group_code" + style="width:200px" + multiple + collapse-tags + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in groupArr" + :key="item.usergroupcode" + :label="item.usergroupname" + :value="item.usergroupcode" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getRoleAssignedUserData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :row-key="getRowKey" + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @selection-change="handleSelectionChange" + @sort-change="sortChange" + > + <el-table-column + type="selection" + width="50" + :reserve-selection="true" + fixed + /> + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="usercode" + label="鐢ㄦ埛缂栫爜" + sortable="custom" + /> + <el-table-column + prop="username" + label="鐢ㄦ埛鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="storg_name" + label="鎵�灞炵粍缁�" + sortable="custom" + /> + <el-table-column + prop="rolename" + label="瑙掕壊" + show-overflow-tooltip + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.rolename ? row.rolename : '/' }} + </template> + </el-table-column> + <el-table-column + prop="postname" + label="宀椾綅" + sortable="custom" + show-overflow-tooltip + > + <template slot-scope="{row}"> + {{ row.postname ? row.postname : '/' }} + </template> + </el-table-column> + <el-table-column + prop="group_name" + label="鐝粍" + show-overflow-tooltip + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.group_name ? row.group_name : '/' }} + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + width="200" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button + type="text" + style="cursor: pointer;font-size: 14px" + @click="cancel(row.usercode)" + >鍙栨秷鎺堟潈 + </el-button> + + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getRoleAssignedUserData" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏂板" + :visible.sync="dialogVisible" + width="1200px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div> + <el-table + ref="tableDataDialogRef" + class="tableFixed" + :data="tableDataDialog" + row-class-name="custom-row" + + height="400" + border + :style="{width: 100+'%',height:'400px',}" + highlight-current-row + :row-key="getRowKey" + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @selection-change="handleDialogSelectionChange" + > + <el-table-column + type="selection" + width="50" + :reserve-selection="true" + fixed + /> + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="usercode" + label="鐢ㄦ埛缂栫爜" + /> + <el-table-column + prop="username" + label="鐢ㄦ埛鍚嶇О" + /> + <el-table-column + prop="storg_name" + label="鎵�灞炵粍缁�" + /> + <el-table-column + prop="rolename" + show-overflow-tooltip + label="瑙掕壊" + > + <template slot-scope="{row}"> + {{ row.rolename?row.rolename:'/' }} + </template> + </el-table-column> + <el-table-column + prop="postname" + label="宀椾綅" + show-overflow-tooltip + > + <template slot-scope="{row}"> + {{ row.postname?row.postname:'/' }} + </template> + </el-table-column> + <el-table-column + prop="group_name" + show-overflow-tooltip + label="鐝粍" + > + <template slot-scope="{row}"> + {{ row.group_name?row.group_name:'/' }} + </template> + </el-table-column> + </el-table> + <!--鍒嗛〉--> + <pagination + :total="totalDialog" + :page.sync="dialogForm.page" + :limit.sync="dialogForm.rows" + align="right" + style="margin-top: 10px;" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="add" + /> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button + v-waves + @click="dialogVisibleCancel" + >鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + RoleAssignedUserBatchAdd, + RoleAssignedUserBatchCancel, + RoleAssignedUserData +} from '@/api/basicSettings' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import arrayToTree from 'array-to-tree' +import { GroupsPermissions, PostPermissions, PrentOrganization, RolePermissions } from '@/api/GeneralBasicData' + +export default { + name: 'RoleDivider', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + flag: 'TRUE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�) + role_code: '', // 瑙掕壊缂栫爜 + usercode: '', // 鐢ㄦ埛缂栫爜 + username: '', // 鐢ㄦ埛鍚嶇О + storg_code: [], // + post_code: [], // + group_code: [], // + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + + cascaderOptions: [], + defaultProps: { + checkStrictly: true, + expandTrigger: 'hover', + value: 'torg_code', + label: 'torg_name' + }, + roleArr: [], + postArr: [], + groupArr: [], + + dialogVisible: false, + dialogForm: { + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + tableDataDialog: [], + totalDialog: 10, + + batchRoleCode: [], + batchDialogRoleCode: [] + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getAllSelectData() + this.getPrentOrganization() + }, + created() { + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getAllSelectData() + this.getPrentOrganization() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getRoleAssignedUserData() { + if (window.location.hash.indexOf('?') !== -1) { + this.form.role_code = window.location.hash.split('?')[1].split('=')[1] + } + + if (!this.form.role_code) { + this.form.role_code = this.roleArr[0].rolecode + } + + this.form.storg_code = this.form.storg_code ? this.form.storg_code[this.form.storg_code.length - 1] : '' + this.form.post_code = this.form.post_code ? this.form.post_code.join(',') : '' + this.form.group_code = this.form.group_code ? this.form.group_code.join(',') : '' + + const res = await RoleAssignedUserData(this.form) + this.tableData = res.data + this.total = res.count + }, + async getPrentOrganization() { + const { data: res } = await PrentOrganization() + this.cascaderOptions = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'torg_code', + childrenProperty: 'children' + }) + }, + // 宀椾綅 瑙掕壊 鐝粍 + async getAllSelectData() { + const { data: res2 } = await RolePermissions() + this.roleArr = res2 + await this.getRoleAssignedUserData() + + const { data: res1 } = await PostPermissions() + this.postArr = res1 + + const { data: res3 } = await GroupsPermissions() + this.groupArr = res3 + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getRoleAssignedUserData() + }, + // 閲嶇疆 + reset() { + this.form.usercode = '' + this.form.username = '' + + this.form.storg_code = [] + this.form.post_code = [] + this.form.group_code = [] + this.getRoleAssignedUserData() + }, + roleChange(val) { + this.getRoleAssignedUserData() + this.batchRoleCode = [] + this.$refs.tableDataRef.clearSelection() + }, + + async cancel(code) { + // if (!this.form.role_code) { + // return this.$message.error('') + // } + + const res = await RoleAssignedUserBatchCancel([code], this.form.role_code) + if (res.code === '200') { + this.$notify.success('鍙栨秷鎺堟潈鎴愬姛锛�') + await this.getRoleAssignedUserData() + } else { + this.$notify.error('鍙栨秷鎺堟潈澶辫触锛�') + } + }, + + async batchCancel() { + const res = await RoleAssignedUserBatchCancel(this.batchRoleCode, this.form.role_code) + if (res.code === '200') { + this.$notify.success(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冩垚鍔燂紒') + await this.getRoleAssignedUserData() + this.batchRoleCode = [] + this.$refs.tableDataRef.clearSelection() + } else { + this.$notify.error(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冨け璐ワ紒') + } + }, + + // 鏂板鎸夐挳 + async add() { + this.dialogVisible = true + + const data = { + flag: 'FALSE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�) + role_code: this.form.role_code, // 瑙掕壊缂栫爜 + usercode: '', // 鐢ㄦ埛缂栫爜 + username: '', // 鐢ㄦ埛鍚嶇О + storg_code: '', // + post_code: '', // + group_code: '', // + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: this.dialogForm.page, // 绗嚑椤� + rows: this.dialogForm.rows // 姣忛〉澶氬皯鏉� + } + const res = await RoleAssignedUserData(data) + this.tableDataDialog = res.data + this.totalDialog = res.count + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + // this.form.flag = 'TRUE' + }, + getRowKey(row) { + return row.usercode + }, + handleSelectionChange(rows) { + this.batchRoleCode = rows.map(i => i.usercode) + }, + handleDialogSelectionChange(rows) { + this.batchDialogRoleCode = rows.map(i => i.usercode) + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + async dialogVisibleConfirm() { + const res = await RoleAssignedUserBatchAdd(this.batchDialogRoleCode, this.form.role_code) + if (res.code === '200') { + this.$notify.success(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冩垚鍔燂紒') + await this.getRoleAssignedUserData() + this.batchDialogRoleCode = [] + this.$refs.tableDataDialogRef.clearSelection() + this.dialogVisible = false + } else { + this.$notify.error(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冨け璐ワ紒') + } + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue index d5bc41a..d5c9dbe 100644 --- a/src/views/basicSettings/roleList.vue +++ b/src/views/basicSettings/roleList.vue @@ -1,480 +1,487 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=4')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;"> - <el-input v-model="form.role_code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;"> - <el-input v-model="form.role_name" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getRoleData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="120" - fixed - label="搴忓彿" - /> - <el-table-column - prop="rolecode" - label="瑙掕壊缂栫爜" - sortable="custom" - /> - <el-table-column - prop="rolename" - label="瑙掕壊鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="status" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="dataname"--> - <!-- label="鏉冮檺鑼冨洿"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="description" - label="澶囨敞" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description?row.description:'/' }} - </template> - </el-table-column> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="160" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - - <el-dropdown placement="bottom" @command="command=>handleCommand(command,row)"> - <div - class="el-dropdown-link" - style="display: flex;align-content: center; - justify-content: center; - cursor: pointer;" - :style="{color:$store.state.settings.theme}" - > - <div>鏇村</div> - <div> - <i class="el-icon-arrow-down el-icon--right" /> - </div> - </div> - <el-dropdown-menu slot="dropdown"> - <el-dropdown-item icon="el-icon-circle-check" command="menuPower">鑿滃崟鏉冮檺</el-dropdown-item> - <el-dropdown-item icon="el-icon-user" command="divideUser">鍒嗛厤鐢ㄦ埛</el-dropdown-item> - <!-- <el-dropdown-item icon="el-icon-download" command="downloadMenu">瀵煎嚭鑿滃崟</el-dropdown-item>--> - </el-dropdown-menu> - </el-dropdown> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getRoleData" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <!-- <el-form-item label="瑙掕壊缂栫爜" prop="rolecode">--> - <!-- <el-input v-model="dialogForm.rolecode" :disabled="operation!=='add'" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="瑙掕壊鍚嶇О" prop="rolename"> - <el-input v-model="dialogForm.rolename" style="width: 200px" /> - </el-form-item> - - <!-- <el-form-item required label="鏁版嵁鑼冨洿">--> - <!-- <el-select--> - <!-- v-model="dialogForm.datacode"--> - <!-- style="width:200px"--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- :popper-append-to-body="false"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in datacodeArr"--> - <!-- :key="item.datacode"--> - <!-- :label="item.dataname"--> - <!-- :value="item.datacode"--> - <!-- />--> - <!-- </el-select>--> - <!-- </el-form-item>--> - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.status" style="width: 200px"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - <!-- <el-form-item v-if="dialogForm.datacode==='CUSTOM'" label="鏁版嵁鏉冮檺" style="margin: 0">--> - <!-- <el-checkbox-group v-model="checkboxGroupSelected" @change="checkboxGroupChange">--> - <!-- <el-checkbox v-for="item in checkboxGroup" :key="item" :label="item">--> - <!-- {{ item }}--> - <!-- <el-tooltip class="item" effect="dark" content="鍕鹃�夌埗鑺傜偣鏄惁鍚屾椂閫変腑瀛愯妭鐐�" placement="top">--> - <!-- <i v-if="item==='鐖跺瓙鑱斿姩'" class="el-icon-question" />--> - <!-- </el-tooltip>--> - <!-- </el-checkbox>--> - <!-- </el-checkbox-group>--> - <!-- </el-form-item>--> - <!-- <el-card--> - <!-- v-if="dialogForm.datacode==='CUSTOM'"--> - <!-- class="box-card"--> - <!-- shadow="never"--> - <!-- style="margin-bottom: 30px;width: 78%;margin-left: 12%;"--> - <!-- >--> - - <!-- <el-tree--> - <!-- ref="tree"--> - <!-- :key="checkboxGroupSelected.toString()"--> - <!-- :data="treeData"--> - <!-- show-checkbox--> - <!-- :check-strictly="!checkboxGroupSelected.includes('鐖跺瓙鑱斿姩')"--> - <!-- :default-expand-all="checkboxGroupSelected.includes('灞曞紑/鎶樺彔')"--> - <!-- node-key="torg_code"--> - <!-- :props="defaultProps"--> - <!-- />--> - <!-- </el-card>--> - - <el-form-item label="澶囨敞"> - <el-input v-model="dialogForm.description" type="textarea" style="width:500px" /> - </el-form-item> - - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateGroup, - DeleteGroup, RoleAddUpdateSava, - RoleData, RoleDeleteSava -} from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { DataPermissions, PrentOrganization } from '@/api/GeneralBasicData' -import arrayToTree from 'array-to-tree' - -export default { - name: 'RoleList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - role_code: '', - role_name: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - rolecode: '', // - rolename: '', // - datacode: 'ALL', - description: '', - datapermissions: '', // 鏁版嵁鏉冮檺 - status: 'Y'// 鐘舵�� - }, - datacodeArr: [], - checkboxGroupSelected: ['灞曞紑/鎶樺彔', '鐖跺瓙鑱斿姩'], - checkboxGroup: ['灞曞紑/鎶樺彔', '鍏ㄩ��/鍏ㄤ笉閫�', '鐖跺瓙鑱斿姩'], - operation: '', - dialogFormRules: { - rolecode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - rolename: [ - { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } - ] - }, - defaultProps: { - children: 'children', - label: 'torg_name' - }, - treeData: [] - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getRoleData() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getPrentOrganization() - this.getDataPermissions() - }, - methods: { - async getRoleData() { - const res = await RoleData(this.form) - this.tableData = res.data - this.total = res.count - }, - async getDataPermissions() { - const { data: res } = await DataPermissions() - this.datacodeArr = res - }, - // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� - async getPrentOrganization() { - const { data: res } = await PrentOrganization() - this.treeData = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'torg_code', - childrenProperty: 'children' - }) - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getRoleData() - }, - // 閲嶇疆 - reset() { - this.form.role_code = '' - this.form.role_name = '' - this.getRoleData() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - this.$nextTick(() => { - this.dialogForm.rolecode = row.rolecode - this.dialogForm.rolename = row.rolename - this.dialogForm.datacode = row.datacode - this.dialogForm.status = row.status - this.dialogForm.description = row.description - if (this.dialogForm.datacode === 'CUSTOM') { - setTimeout(() => { - this.$refs.tree.setCheckedKeys(row.datapermissionscode.split(',')) - }) - } - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - RoleDeleteSava({ rolecode: row.rolecode }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getRoleData() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - checkboxGroupChange(val) { - if (val.includes('鍏ㄩ��/鍏ㄤ笉閫�')) { - this.$refs.tree.setCheckedKeys([this.treeData[0].torg_code]) - } - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.rolecode = '' - this.dialogForm.rolename = '' - this.dialogForm.description = '' - this.dialogForm.datapermissions = '' - this.dialogForm.datacode = 'ALL' - this.dialogForm.status = 'Y' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - if (this.$refs.tree) { - this.dialogForm.datapermissions = this.$refs.tree.getCheckedKeys().join(',') - } - RoleAddUpdateSava(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getRoleData() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - handleCommand(command, row) { - console.log(command, row) - if (command === 'menuPower') { - this.$router.push('./powerDivider?rolecode=' + row.rolecode) - } - if (command === 'divideUser') { - this.$router.push('./roleDivider?rolecode=' + row.rolecode) - } - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=4')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;"> + <el-input v-model="form.role_code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;"> + <el-input v-model="form.role_name" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getRoleData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="120" + fixed + label="搴忓彿" + /> + <el-table-column + prop="rolecode" + label="瑙掕壊缂栫爜" + sortable="custom" + /> + <el-table-column + prop="rolename" + label="瑙掕壊鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="status" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="dataname"--> + <!-- label="鏉冮檺鑼冨洿"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="description" + label="澶囨敞" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description?row.description:'/' }} + </template> + </el-table-column> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="160" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + + <el-dropdown placement="bottom" @command="command=>handleCommand(command,row)"> + <div + class="el-dropdown-link" + style="display: flex;align-content: center; + justify-content: center; + cursor: pointer;" + :style="{color:$store.state.settings.theme}" + > + <div>鏇村</div> + <div> + <i class="el-icon-arrow-down el-icon--right" /> + </div> + </div> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item icon="el-icon-circle-check" command="menuPower">鑿滃崟鏉冮檺</el-dropdown-item> + <el-dropdown-item icon="el-icon-user" command="divideUser">鍒嗛厤鐢ㄦ埛</el-dropdown-item> + <!-- <el-dropdown-item icon="el-icon-download" command="downloadMenu">瀵煎嚭鑿滃崟</el-dropdown-item>--> + </el-dropdown-menu> + </el-dropdown> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getRoleData" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <!-- <el-form-item label="瑙掕壊缂栫爜" prop="rolecode">--> + <!-- <el-input v-model="dialogForm.rolecode" :disabled="operation!=='add'" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="瑙掕壊鍚嶇О" prop="rolename"> + <el-input v-model="dialogForm.rolename" style="width: 200px" /> + </el-form-item> + + <!-- <el-form-item required label="鏁版嵁鑼冨洿">--> + <!-- <el-select--> + <!-- v-model="dialogForm.datacode"--> + <!-- style="width:200px"--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- :popper-append-to-body="false"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in datacodeArr"--> + <!-- :key="item.datacode"--> + <!-- :label="item.dataname"--> + <!-- :value="item.datacode"--> + <!-- />--> + <!-- </el-select>--> + <!-- </el-form-item>--> + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.status" style="width: 200px"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + <!-- <el-form-item v-if="dialogForm.datacode==='CUSTOM'" label="鏁版嵁鏉冮檺" style="margin: 0">--> + <!-- <el-checkbox-group v-model="checkboxGroupSelected" @change="checkboxGroupChange">--> + <!-- <el-checkbox v-for="item in checkboxGroup" :key="item" :label="item">--> + <!-- {{ item }}--> + <!-- <el-tooltip class="item" effect="dark" content="鍕鹃�夌埗鑺傜偣鏄惁鍚屾椂閫変腑瀛愯妭鐐�" placement="top">--> + <!-- <i v-if="item==='鐖跺瓙鑱斿姩'" class="el-icon-question" />--> + <!-- </el-tooltip>--> + <!-- </el-checkbox>--> + <!-- </el-checkbox-group>--> + <!-- </el-form-item>--> + <!-- <el-card--> + <!-- v-if="dialogForm.datacode==='CUSTOM'"--> + <!-- class="box-card"--> + <!-- shadow="never"--> + <!-- style="margin-bottom: 30px;width: 78%;margin-left: 12%;"--> + <!-- >--> + + <!-- <el-tree--> + <!-- ref="tree"--> + <!-- :key="checkboxGroupSelected.toString()"--> + <!-- :data="treeData"--> + <!-- show-checkbox--> + <!-- :check-strictly="!checkboxGroupSelected.includes('鐖跺瓙鑱斿姩')"--> + <!-- :default-expand-all="checkboxGroupSelected.includes('灞曞紑/鎶樺彔')"--> + <!-- node-key="torg_code"--> + <!-- :props="defaultProps"--> + <!-- />--> + <!-- </el-card>--> + + <el-form-item label="澶囨敞"> + <el-input v-model="dialogForm.description" type="textarea" style="width:500px" /> + </el-form-item> + + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateGroup, + DeleteGroup, RoleAddUpdateSava, + RoleData, RoleDeleteSava +} from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { DataPermissions, PrentOrganization } from '@/api/GeneralBasicData' +import arrayToTree from 'array-to-tree' + +export default { + name: 'RoleList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + role_code: '', + role_name: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + rolecode: '', // + rolename: '', // + datacode: 'ALL', + description: '', + datapermissions: '', // 鏁版嵁鏉冮檺 + status: 'Y'// 鐘舵�� + }, + datacodeArr: [], + checkboxGroupSelected: ['灞曞紑/鎶樺彔', '鐖跺瓙鑱斿姩'], + checkboxGroup: ['灞曞紑/鎶樺彔', '鍏ㄩ��/鍏ㄤ笉閫�', '鐖跺瓙鑱斿姩'], + operation: '', + dialogFormRules: { + rolecode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + rolename: [ + { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } + ] + }, + defaultProps: { + children: 'children', + label: 'torg_name' + }, + treeData: [] + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getRoleData() + this.getPrentOrganization() + this.getDataPermissions() + }, + created() { + this.getRoleData() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getPrentOrganization() + this.getDataPermissions() + }, + methods: { + async getRoleData() { + const res = await RoleData(this.form) + this.tableData = res.data + this.total = res.count + }, + async getDataPermissions() { + const { data: res } = await DataPermissions() + this.datacodeArr = res + }, + // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� + async getPrentOrganization() { + const { data: res } = await PrentOrganization() + this.treeData = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'torg_code', + childrenProperty: 'children' + }) + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getRoleData() + }, + // 閲嶇疆 + reset() { + this.form.role_code = '' + this.form.role_name = '' + this.getRoleData() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + this.$nextTick(() => { + this.dialogForm.rolecode = row.rolecode + this.dialogForm.rolename = row.rolename + this.dialogForm.datacode = row.datacode + this.dialogForm.status = row.status + this.dialogForm.description = row.description + if (this.dialogForm.datacode === 'CUSTOM') { + setTimeout(() => { + this.$refs.tree.setCheckedKeys(row.datapermissionscode.split(',')) + }) + } + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + RoleDeleteSava({ rolecode: row.rolecode }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getRoleData() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + checkboxGroupChange(val) { + if (val.includes('鍏ㄩ��/鍏ㄤ笉閫�')) { + this.$refs.tree.setCheckedKeys([this.treeData[0].torg_code]) + } + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.rolecode = '' + this.dialogForm.rolename = '' + this.dialogForm.description = '' + this.dialogForm.datapermissions = '' + this.dialogForm.datacode = 'ALL' + this.dialogForm.status = 'Y' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + if (this.$refs.tree) { + this.dialogForm.datapermissions = this.$refs.tree.getCheckedKeys().join(',') + } + RoleAddUpdateSava(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getRoleData() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + handleCommand(command, row) { + console.log(command, row) + if (command === 'menuPower') { + this.$router.push('./powerDivider?rolecode=' + row.rolecode) + } + if (command === 'divideUser') { + this.$router.push('./roleDivider?rolecode=' + row.rolecode) + } + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/basicSettings/storageList.vue b/src/views/basicSettings/storageList.vue index 4035354..37419b6 100644 --- a/src/views/basicSettings/storageList.vue +++ b/src/views/basicSettings/storageList.vue @@ -1,887 +1,892 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div style="display: flex"> - <div style="width: 300px;margin: 10px 10px 0 0;background:#fff"> - - <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> - <div style="display: flex;"> - <div - style="width: 5px;height: 100%;border-radius: 5px;" - :style="{background:$store.state.settings.theme}" - /> - <div style="margin-left: 8px;">浠撳簱</div> - </div> - - <!-- <div style="margin-right:10px">--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鏂板" placement="top">--> - <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="treeAddClick('add')" />--> - <!-- </el-tooltip>--> - <!-- </div>--> - - </div> - - <el-tree - ref="treeLeftRef" - style="padding: 10px;overflow: auto" - :style="{height:(tableHeight+222)+'px'}" - :data="treeLeft" - node-key="code" - highlight-current - :props="defaultPropsLeft" - :default-expand-all="true" - :expand-on-click-node="false" - @node-click="getTSecLocaData" - > - <!-- <span slot-scope="{ node, data }" class="custom-tree-node">--> - <!-- <span v-if="!data.isEdit">{{ data.name }}</span>--> - <!-- <span v-if="!data.isEdit">--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="缂栬緫" placement="top">--> - <!-- <i--> - <!-- v-if="data.code!=='-1'"--> - <!-- class="el-icon-edit"--> - <!-- style="margin-right:10px;color: #999"--> - <!-- @click.stop="treeEditClick(node,data,'edit')"--> - <!-- />--> - <!-- </el-tooltip>--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i--> - <!-- v-if="data.code!=='-1'"--> - <!-- class="el-icon-delete"--> - <!-- style="margin-right: 4px;color: #999"--> - <!-- @click.stop="treeDeleteClick(node,data)"--> - <!-- />--> - <!-- </el-tooltip>--> - <!-- </span>--> - <!-- </span>--> - </el-tree> - </div> - - <div - style=" width:calc(100% - 300px);" - > - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=7')" - >瀵煎叆 - </el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="璐т綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.locacode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璐т綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.locaname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <!-- <el-form-item label="瀛樿揣瑙勬牸" style=" display: flex;">--> - <!-- <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button - v-waves - type="primary" - icon="el-icon-search" - @click="getTSecLocaData($refs.treeLeftRef.getCurrentNode())" - >鏌ヨ - </el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height: 5px;" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- prop="RowNum"--> - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="code" - label="璐т綅缂栫爜" - sortable="custom" - /> - <el-table-column - prop="name" - label="璐т綅鍚嶇О" - show-overflow-tooltip - sortable="custom" - /> - - <el-table-column - prop="stckname" - label="瀵瑰簲浠撳簱" - sortable="custom" - /> - - <el-table-column - prop="status" - label="鐘舵��" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='0'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='1'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - - <el-table-column - prop="description" - label="澶囨敞" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description ? row.description : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- label="鏁版嵁鏉ユ簮"--> - <!-- prop="data_sources"--> - <!-- sortable="custom"--> - <!-- width="110"--> - <!-- />--> - <el-table-column - label="鍒涘缓浜哄憳" - prop="username" - sortable="custom" - width="110" - /> - <el-table-column - label="鍒涘缓鏃堕棿" - prop="lm_date" - sortable="custom" - width="160" - /> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getTSecLocaData($refs.treeLeftRef.getCurrentNode())" - /> - - </div> - </div> - </div> - - <!-- 寰�鏉ョ被鍒柊澧炰慨鏀�--> - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogClassVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClassClose" - @close="handleClassClose" - > - <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="80px"> - <el-form-item label="鍒嗙被缂栫爜" prop="customerclasscode"> - <el-input v-model="dialogClassForm.customerclasscode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍒嗙被鍚嶇О" prop="customerclassname"> - <el-input v-model="dialogClassForm.customerclassname" style="width: 200px" /> - </el-form-item> - <el-form-item label="涓婄骇鍒嗙被"> - <el-select - v-model="dialogClassForm.parentcode" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - clearable - > - <el-option - v-for="item in treeLeftArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </el-form> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleClassConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- 寰�鏉ュ崟浣嶆柊澧炰慨鏀�--> - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - - <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> - <!-- <el-divider content-position="left">鍩烘湰淇℃伅</el-divider>--> - <el-form-item label="璐т綅缂栫爜" prop="locacode"> - <el-input v-model="dialogForm.locacode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="璐т綅鍚嶇О" prop="locaname"> - <el-input v-model="dialogForm.locaname" style="width: 200px" /> - </el-form-item> - - <el-form-item label="瀵瑰簲浠撳簱" prop="stckcode"> - <el-select - v-model="dialogForm.stckcode" - style="width:200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - :disabled="!isEdit&&operation==='edit'" - @change="stckcodeChange" - > - <el-option - v-for="item in stckcodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="涓婄骇璐т綅"> - <el-select - v-model="dialogForm.parentlocacode" - style="width:200px" - placeholder="璇烽�夋嫨" - clearable - filterable - :disabled="dialogForm.stckcode===''" - :popper-append-to-body="false" - > - <el-option - v-for="item in parentlocacodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.status" style="width: 200px"> - <el-radio label="0">姝e父</el-radio> - <el-radio label="1">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - - <el-form-item label="澶囨敞"> - <el-input - v-model="dialogForm.description" - type="textarea" - :autosize="{ minRows: 2, maxRows: 4}" - style="width: 200px;" - /> - </el-form-item> - - </el-form> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import waves from '@/directive/waves' -import Pagination from '@/components/Pagination' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import arrayToTree from 'array-to-tree' -import { TCunstomerClassTreeAddUpdate, TCunstomerClassTreeDelete, TSecLocaAddUpdate, TSecLocaData, TSecLocaDelete, TSecLocaTree } from '@/api/basicSettings' -import { WareHouseSelectLocation } from '@/api/GeneralBasicData' - -const _ = require('lodash') - -export default { - name: 'StorageList', - directives: { waves, elDragDialog }, - components: { - Pagination - }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - operation: '', - - treeLeft: [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ], // 宸︿晶鏍� - treeLeftArr: [], - defaultPropsLeft: { - children: 'children', - label: 'name' - }, - - tableData: [], - form: { - stckcode: '', - locacode: '', - locaname: '', - partspec: '', - flag: '', - page: 1, - rows: 20, - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc' // 鎺掑簭瀛楁 - }, - total: 0, - dialogClassVisible: false, - dialogClassForm: { - data_sources: '', // 鏁版嵁鏉ユ簮:ERP/MES - customerclasscode: '', // 瀛樿揣鍒嗙被缂栫爜 - customerclassname: '', // 瀛樿揣鍒嗙被鍚嶇О - parentcode: '', // 涓婄骇鍒嗙被缂栫爜 - OperType: ''// OperType - }, - classArr: [], - dialogClassFormRules: { - customerclasscode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - customerclassname: [ - { required: true, message: '璇疯緭寰�鏉ュ崟浣嶅悕绉�', trigger: ['blur', 'change'] } - ] - }, - - dialogVisible: false, - dialogForm: { - data_sources: 'MES', // 鏁版嵁鏉ユ簮锛汦RP/MES - locacode: '', // - locaname: '', // - stckcode: '', // 瀵瑰簲浠撳簱缂栫爜 - parentlocacode: '', // 涓婄骇璐т綅缂栫爜 - status: '0', // 浣跨敤鐘舵��: 姝e父(0)鍋滅敤(1) - description: '', - depth: '', // 灞傜骇 - - OperType: '' // 鎿嶄綔绫诲瀷 - }, - dialogFormRules: { - locacode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - locaname: [ - { required: true, message: '璇疯緭鍏ュ線鏉ュ崟浣嶅悕绉�', trigger: ['blur', 'change'] } - ], - stckcode: [ - { required: true, message: '璇烽�夋嫨瀵瑰簲浠撳簱', trigger: ['blur', 'change'] } - ] - }, - stckcodeArr: [], - parentlocacodeArr: [], - - isEdit: true - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getTSecLocaTree() - }, - methods: { - async getTSecLocaTree() { - const { data: res } = await TSecLocaTree() - res.forEach(e => { - e.name = e.code + ' ' + e.name - }) - // 鑾峰彇浠撳簱 - const ck = res.filter(i => i.depth === 0)// 灞傜骇涓�0鐨� 鏄粨搴� - const kw = res.filter(i => i.depth !== 0)// 鍙嶄箣 涓轰粨浣� - this.stckcodeArr = ck - const tree = arrayToTree(kw, { - parentProperty: 'idparent', - customID: 'code', - childrenProperty: 'children' - }) - const group = _.groupBy(tree, i => i.warhouse) - const newArr = [] - ck.forEach(j => { - if (Object.keys(group).includes(j.code)) { - newArr.push({ - code: j.code, - name: j.name, - depth: 0, - idparent: '-1', - children: group[j.code] - }) - } else { - newArr.push({ - code: j.code, - name: j.name, - depth: 0, - idparent: '-1', - children: [] - }) - } - }) - this.treeLeft = [ - { - code: '-1', - name: '鍏ㄩ儴', - idparent: '', - children: newArr - } - ]// 宸︿晶鏍� - this.$nextTick(() => { - this.$refs.treeLeftRef.setCurrentKey('-1') - this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) - }) - - console.log(JSON.parse(JSON.stringify(this.treeLeft))) - }, - - async getTSecLocaData(node) { - let result = '' - if (node.code === '-1') { - result = node.children.map(i => i.code) - } else { - result = [node.code] - } - // const result = this.getChildrenCodeMethod(node, []) - // if (result.includes('-1')) { - // result.shift() - // } - this.form.stckcode = result.join(',') - - if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { - this.form.flag = -1 - } else { - this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth - } - - const res = await TSecLocaData(this.form) - - this.tableData = res.data - this.total = res.count - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 280 - this.$refs.tableDataRef.doLayout() - }) - }, - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - const temp = this.$refs.treeLeftRef.getCurrentNode() - - if (temp.idparent === '-1' || temp.idparent === '') { - this.isEdit = temp.depth !== 1 - } else { - this.isEdit = false - } - - // this.$nextTick(() => { - this.dialogForm.data_sources = row.data_sources - this.dialogForm.locacode = row.code - this.dialogForm.locaname = row.name - this.dialogForm.stckcode = row.stckcode - - const { data: res } = await WareHouseSelectLocation({ warhousecode: row.stckcode }) - - this.parentlocacodeArr = res - // this.parentlocacodeArr = this.treeLeftArr.filter(i => i.idparent === this.dialogForm.stckcode) - - this.dialogForm.parentlocacode = row.parentname ? row.parentcode : null - this.dialogForm.status = row.status - this.dialogForm.description = row.description - // }) - }, - del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - TSecLocaDelete({ locacode: row.code, data_sources: row.data_sources }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getTSecLocaTree() - this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - reset() { - this.form.stckcode = '' - this.form.locacode = '' - this.form.locaname = '' - this.$refs.treeLeftRef.setCurrentKey('-1') - this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.data_sources = 'MES' - this.dialogForm.locacode = '' - this.dialogForm.locaname = '' - this.dialogForm.stckcode = '' - this.dialogForm.parentlocacode = '' - this.dialogForm.description = '' - this.dialogForm.status = '0' - - if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { - this.form.flag = '' - } else { - this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth - } - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 2) - - if (this.dialogForm.locacode === this.dialogForm.parentlocacode) { - return this.$message.error('涓婄骇璐т綅涓嶈兘鏄揣浣嶆湰韬紒') - } - - if (this.dialogForm.parentlocacode === '') { - this.dialogForm.depth = 1 - } else { - this.dialogForm.depth = parseFloat(this.parentlocacodeArr.find(i => i.code === this.dialogForm.parentlocacode).depth) + 1 - } - - this.$store.state.app.buttonIsDisabled = true - TSecLocaAddUpdate(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getTSecLocaTree() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - async stckcodeChange(val) { - const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) - this.parentlocacodeArr = res - - this.dialogForm.parentlocacode = '' - // const res = this.recursiveLookupArray([], val)// 閫掑綊鏌ユ壘鏁扮粍 - // this.parentlocacodeArr = res - }, - recursiveLookupArray(newArr, val) { - const temp = this.treeLeftArr.filter(i => i.idparent === val) - if (temp.length > 0 && temp) { - temp.forEach(i => { - newArr.push(i) - this.recursiveLookupArray(newArr, i.code) - }) - } - return newArr - }, - - // 閫掑綊鍙栧瓙闆嗙殑鎵�鏈塩ode - getChildrenCodeMethod(node, result) { - result.push(node.code) - if (node.children && node.children.length > 0) { - node.children.forEach(i => { - this.getChildrenCodeMethod(i, result) - }) - } - return result - }, - - treeEditClick(node, data, operation) { - this.dialogClassForm.data_sources = data.data_sources - this.dialogClassForm.customerclasscode = data.code - this.dialogClassForm.customerclassname = data.name - this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent - this.dialogClassForm.OperType = 'Update' - this.operation = operation - this.dialogClassVisible = true - }, - treeDeleteClick(node, data) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const result = this.getChildrenCodeMethod(data, []) - TCunstomerClassTreeDelete({ customerclasscode: result.join(',') }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getTSecLocaTree() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - treeAddClick(operation) { - this.operation = operation - this.dialogClassVisible = true - this.dialogClassForm.OperType = 'Add' - this.dialogClassForm.data_sources = 'MES' - }, - - handleClassClose() { - this.dialogClassForm.data_sources = '' - this.dialogClassForm.customerclasscode = '' - this.dialogClassForm.customerclassname = '' - this.dialogClassForm.parentcode = '' - this.dialogClassForm.OperType = '' - this.$refs.dialogClassForm.clearValidate() - }, - dialogVisibleClassCancel() { - this.dialogClassVisible = false - }, - dialogVisibleClassConfirm() { - this.$refs.dialogClassForm.validate(valid => { - if (valid) { - TCunstomerClassTreeAddUpdate(this.dialogClassForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogClassVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getTSecLocaTree() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - unittypcodeChange(val) { - console.log(val) - - this.dialogForm.unitcode = '' - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - this.dialogForm.idUnitByStock = '' - this.dialogForm.idUnitByPurchase = '' - this.dialogForm.idUnitBySale = '' - this.dialogForm.idunitbymanufacture = '' - // this.$refs.dialogForm.clearValidate() - // this.$forceUpdate() - }, - unitcodeChange(val, type) { - console.log(val) - - if (type === '1') { - // this.dialogForm.unitcode = val - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - - const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname - - this.dialogForm.idUnitByStock = unitname - this.dialogForm.idUnitByPurchase = unitname - this.dialogForm.idUnitBySale = unitname - this.dialogForm.idunitbymanufacture = unitname - } - - if (type === '0') { - const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children - - this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') - this.idUnitBvStockArr = t - - const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode - this.dialogForm.unitsubcode = mainUnitCode - this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode - - this.dialogForm.idUnitByStock = mainUnitCode - this.dialogForm.idUnitByPurchase = mainUnitCode - this.dialogForm.idUnitBySale = mainUnitCode - this.dialogForm.idunitbymanufacture = mainUnitCode - } - } - } -} -</script> - -<style scoped lang="scss"> -.custom-tree-node { - flex: 1; - display: flex; - align-items: center; - justify-content: space-between; - font-size: 14px; - padding-right: 8px; -} - -//::v-deep .el-checkbox__label { -// width: 55px; -//} -// -.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover { - color: #000 !important; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div style="display: flex"> + <div style="width: 300px;margin: 10px 10px 0 0;background:#fff"> + + <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> + <div style="display: flex;"> + <div + style="width: 5px;height: 100%;border-radius: 5px;" + :style="{background:$store.state.settings.theme}" + /> + <div style="margin-left: 8px;">浠撳簱</div> + </div> + + <!-- <div style="margin-right:10px">--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鏂板" placement="top">--> + <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="treeAddClick('add')" />--> + <!-- </el-tooltip>--> + <!-- </div>--> + + </div> + + <el-tree + ref="treeLeftRef" + style="padding: 10px;overflow: auto" + :style="{height:(tableHeight+222)+'px'}" + :data="treeLeft" + node-key="code" + highlight-current + :props="defaultPropsLeft" + :default-expand-all="true" + :expand-on-click-node="false" + @node-click="getTSecLocaData" + > + <!-- <span slot-scope="{ node, data }" class="custom-tree-node">--> + <!-- <span v-if="!data.isEdit">{{ data.name }}</span>--> + <!-- <span v-if="!data.isEdit">--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="缂栬緫" placement="top">--> + <!-- <i--> + <!-- v-if="data.code!=='-1'"--> + <!-- class="el-icon-edit"--> + <!-- style="margin-right:10px;color: #999"--> + <!-- @click.stop="treeEditClick(node,data,'edit')"--> + <!-- />--> + <!-- </el-tooltip>--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i--> + <!-- v-if="data.code!=='-1'"--> + <!-- class="el-icon-delete"--> + <!-- style="margin-right: 4px;color: #999"--> + <!-- @click.stop="treeDeleteClick(node,data)"--> + <!-- />--> + <!-- </el-tooltip>--> + <!-- </span>--> + <!-- </span>--> + </el-tree> + </div> + + <div + style=" width:calc(100% - 300px);" + > + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=7')" + >瀵煎叆 + </el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="璐т綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.locacode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璐т綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.locaname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <!-- <el-form-item label="瀛樿揣瑙勬牸" style=" display: flex;">--> + <!-- <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button + v-waves + type="primary" + icon="el-icon-search" + @click="getTSecLocaData($refs.treeLeftRef.getCurrentNode())" + >鏌ヨ + </el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height: 5px;" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- prop="RowNum"--> + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="code" + label="璐т綅缂栫爜" + sortable="custom" + /> + <el-table-column + prop="name" + label="璐т綅鍚嶇О" + show-overflow-tooltip + sortable="custom" + /> + + <el-table-column + prop="stckname" + label="瀵瑰簲浠撳簱" + sortable="custom" + /> + + <el-table-column + prop="status" + label="鐘舵��" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='0'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='1'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + + <el-table-column + prop="description" + label="澶囨敞" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description ? row.description : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- label="鏁版嵁鏉ユ簮"--> + <!-- prop="data_sources"--> + <!-- sortable="custom"--> + <!-- width="110"--> + <!-- />--> + <el-table-column + label="鍒涘缓浜哄憳" + prop="username" + sortable="custom" + width="110" + /> + <el-table-column + label="鍒涘缓鏃堕棿" + prop="lm_date" + sortable="custom" + width="160" + /> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getTSecLocaData($refs.treeLeftRef.getCurrentNode())" + /> + + </div> + </div> + </div> + + <!-- 寰�鏉ョ被鍒柊澧炰慨鏀�--> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogClassVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClassClose" + @close="handleClassClose" + > + <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="80px"> + <el-form-item label="鍒嗙被缂栫爜" prop="customerclasscode"> + <el-input v-model="dialogClassForm.customerclasscode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍒嗙被鍚嶇О" prop="customerclassname"> + <el-input v-model="dialogClassForm.customerclassname" style="width: 200px" /> + </el-form-item> + <el-form-item label="涓婄骇鍒嗙被"> + <el-select + v-model="dialogClassForm.parentcode" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + clearable + > + <el-option + v-for="item in treeLeftArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </el-form> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleClassConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- 寰�鏉ュ崟浣嶆柊澧炰慨鏀�--> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + + <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> + <!-- <el-divider content-position="left">鍩烘湰淇℃伅</el-divider>--> + <el-form-item label="璐т綅缂栫爜" prop="locacode"> + <el-input v-model="dialogForm.locacode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="璐т綅鍚嶇О" prop="locaname"> + <el-input v-model="dialogForm.locaname" style="width: 200px" /> + </el-form-item> + + <el-form-item label="瀵瑰簲浠撳簱" prop="stckcode"> + <el-select + v-model="dialogForm.stckcode" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + :disabled="!isEdit&&operation==='edit'" + @change="stckcodeChange" + > + <el-option + v-for="item in stckcodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="涓婄骇璐т綅"> + <el-select + v-model="dialogForm.parentlocacode" + style="width:200px" + placeholder="璇烽�夋嫨" + clearable + filterable + :disabled="dialogForm.stckcode===''" + :popper-append-to-body="false" + > + <el-option + v-for="item in parentlocacodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.status" style="width: 200px"> + <el-radio label="0">姝e父</el-radio> + <el-radio label="1">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + + <el-form-item label="澶囨敞"> + <el-input + v-model="dialogForm.description" + type="textarea" + :autosize="{ minRows: 2, maxRows: 4}" + style="width: 200px;" + /> + </el-form-item> + + </el-form> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import waves from '@/directive/waves' +import Pagination from '@/components/Pagination' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import arrayToTree from 'array-to-tree' +import { TCunstomerClassTreeAddUpdate, TCunstomerClassTreeDelete, TSecLocaAddUpdate, TSecLocaData, TSecLocaDelete, TSecLocaTree } from '@/api/basicSettings' +import { WareHouseSelectLocation } from '@/api/GeneralBasicData' + +const _ = require('lodash') + +export default { + name: 'StorageList', + directives: { waves, elDragDialog }, + components: { + Pagination + }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + operation: '', + + treeLeft: [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ], // 宸︿晶鏍� + treeLeftArr: [], + defaultPropsLeft: { + children: 'children', + label: 'name' + }, + + tableData: [], + form: { + stckcode: '', + locacode: '', + locaname: '', + partspec: '', + flag: '', + page: 1, + rows: 20, + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc' // 鎺掑簭瀛楁 + }, + total: 0, + dialogClassVisible: false, + dialogClassForm: { + data_sources: '', // 鏁版嵁鏉ユ簮:ERP/MES + customerclasscode: '', // 瀛樿揣鍒嗙被缂栫爜 + customerclassname: '', // 瀛樿揣鍒嗙被鍚嶇О + parentcode: '', // 涓婄骇鍒嗙被缂栫爜 + OperType: ''// OperType + }, + classArr: [], + dialogClassFormRules: { + customerclasscode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + customerclassname: [ + { required: true, message: '璇疯緭寰�鏉ュ崟浣嶅悕绉�', trigger: ['blur', 'change'] } + ] + }, + + dialogVisible: false, + dialogForm: { + data_sources: 'MES', // 鏁版嵁鏉ユ簮锛汦RP/MES + locacode: '', // + locaname: '', // + stckcode: '', // 瀵瑰簲浠撳簱缂栫爜 + parentlocacode: '', // 涓婄骇璐т綅缂栫爜 + status: '0', // 浣跨敤鐘舵��: 姝e父(0)鍋滅敤(1) + description: '', + depth: '', // 灞傜骇 + + OperType: '' // 鎿嶄綔绫诲瀷 + }, + dialogFormRules: { + locacode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + locaname: [ + { required: true, message: '璇疯緭鍏ュ線鏉ュ崟浣嶅悕绉�', trigger: ['blur', 'change'] } + ], + stckcode: [ + { required: true, message: '璇烽�夋嫨瀵瑰簲浠撳簱', trigger: ['blur', 'change'] } + ] + }, + stckcodeArr: [], + parentlocacodeArr: [], + + isEdit: true + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getTSecLocaTree() + }, + created() { + + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getTSecLocaTree() + }, + methods: { + async getTSecLocaTree() { + const { data: res } = await TSecLocaTree() + res.forEach(e => { + e.name = e.code + ' ' + e.name + }) + // 鑾峰彇浠撳簱 + const ck = res.filter(i => i.depth === 0)// 灞傜骇涓�0鐨� 鏄粨搴� + const kw = res.filter(i => i.depth !== 0)// 鍙嶄箣 涓轰粨浣� + this.stckcodeArr = ck + const tree = arrayToTree(kw, { + parentProperty: 'idparent', + customID: 'code', + childrenProperty: 'children' + }) + const group = _.groupBy(tree, i => i.warhouse) + const newArr = [] + ck.forEach(j => { + if (Object.keys(group).includes(j.code)) { + newArr.push({ + code: j.code, + name: j.name, + depth: 0, + idparent: '-1', + children: group[j.code] + }) + } else { + newArr.push({ + code: j.code, + name: j.name, + depth: 0, + idparent: '-1', + children: [] + }) + } + }) + this.treeLeft = [ + { + code: '-1', + name: '鍏ㄩ儴', + idparent: '', + children: newArr + } + ]// 宸︿晶鏍� + this.$nextTick(() => { + this.$refs.treeLeftRef.setCurrentKey('-1') + this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) + }) + + console.log(JSON.parse(JSON.stringify(this.treeLeft))) + }, + + async getTSecLocaData(node) { + let result = '' + if (node.code === '-1') { + result = node.children.map(i => i.code) + } else { + result = [node.code] + } + // const result = this.getChildrenCodeMethod(node, []) + // if (result.includes('-1')) { + // result.shift() + // } + this.form.stckcode = result.join(',') + + if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { + this.form.flag = -1 + } else { + this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth + } + + const res = await TSecLocaData(this.form) + + this.tableData = res.data + this.total = res.count + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 280 + this.$refs.tableDataRef.doLayout() + }) + }, + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + const temp = this.$refs.treeLeftRef.getCurrentNode() + + if (temp.idparent === '-1' || temp.idparent === '') { + this.isEdit = temp.depth !== 1 + } else { + this.isEdit = false + } + + // this.$nextTick(() => { + this.dialogForm.data_sources = row.data_sources + this.dialogForm.locacode = row.code + this.dialogForm.locaname = row.name + this.dialogForm.stckcode = row.stckcode + + const { data: res } = await WareHouseSelectLocation({ warhousecode: row.stckcode }) + + this.parentlocacodeArr = res + // this.parentlocacodeArr = this.treeLeftArr.filter(i => i.idparent === this.dialogForm.stckcode) + + this.dialogForm.parentlocacode = row.parentname ? row.parentcode : null + this.dialogForm.status = row.status + this.dialogForm.description = row.description + // }) + }, + del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + TSecLocaDelete({ locacode: row.code, data_sources: row.data_sources }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getTSecLocaTree() + this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + reset() { + this.form.stckcode = '' + this.form.locacode = '' + this.form.locaname = '' + this.$refs.treeLeftRef.setCurrentKey('-1') + this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.data_sources = 'MES' + this.dialogForm.locacode = '' + this.dialogForm.locaname = '' + this.dialogForm.stckcode = '' + this.dialogForm.parentlocacode = '' + this.dialogForm.description = '' + this.dialogForm.status = '0' + + if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { + this.form.flag = '' + } else { + this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth + } + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 2) + + if (this.dialogForm.locacode === this.dialogForm.parentlocacode) { + return this.$message.error('涓婄骇璐т綅涓嶈兘鏄揣浣嶆湰韬紒') + } + + if (this.dialogForm.parentlocacode === '') { + this.dialogForm.depth = 1 + } else { + this.dialogForm.depth = parseFloat(this.parentlocacodeArr.find(i => i.code === this.dialogForm.parentlocacode).depth) + 1 + } + + this.$store.state.app.buttonIsDisabled = true + TSecLocaAddUpdate(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getTSecLocaTree() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + async stckcodeChange(val) { + const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) + this.parentlocacodeArr = res + + this.dialogForm.parentlocacode = '' + // const res = this.recursiveLookupArray([], val)// 閫掑綊鏌ユ壘鏁扮粍 + // this.parentlocacodeArr = res + }, + recursiveLookupArray(newArr, val) { + const temp = this.treeLeftArr.filter(i => i.idparent === val) + if (temp.length > 0 && temp) { + temp.forEach(i => { + newArr.push(i) + this.recursiveLookupArray(newArr, i.code) + }) + } + return newArr + }, + + // 閫掑綊鍙栧瓙闆嗙殑鎵�鏈塩ode + getChildrenCodeMethod(node, result) { + result.push(node.code) + if (node.children && node.children.length > 0) { + node.children.forEach(i => { + this.getChildrenCodeMethod(i, result) + }) + } + return result + }, + + treeEditClick(node, data, operation) { + this.dialogClassForm.data_sources = data.data_sources + this.dialogClassForm.customerclasscode = data.code + this.dialogClassForm.customerclassname = data.name + this.dialogClassForm.parentcode = data.idparent === '-1' ? '' : data.idparent + this.dialogClassForm.OperType = 'Update' + this.operation = operation + this.dialogClassVisible = true + }, + treeDeleteClick(node, data) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const result = this.getChildrenCodeMethod(data, []) + TCunstomerClassTreeDelete({ customerclasscode: result.join(',') }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getTSecLocaTree() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + treeAddClick(operation) { + this.operation = operation + this.dialogClassVisible = true + this.dialogClassForm.OperType = 'Add' + this.dialogClassForm.data_sources = 'MES' + }, + + handleClassClose() { + this.dialogClassForm.data_sources = '' + this.dialogClassForm.customerclasscode = '' + this.dialogClassForm.customerclassname = '' + this.dialogClassForm.parentcode = '' + this.dialogClassForm.OperType = '' + this.$refs.dialogClassForm.clearValidate() + }, + dialogVisibleClassCancel() { + this.dialogClassVisible = false + }, + dialogVisibleClassConfirm() { + this.$refs.dialogClassForm.validate(valid => { + if (valid) { + TCunstomerClassTreeAddUpdate(this.dialogClassForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogClassVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getTSecLocaTree() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + unittypcodeChange(val) { + console.log(val) + + this.dialogForm.unitcode = '' + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + this.dialogForm.idUnitByStock = '' + this.dialogForm.idUnitByPurchase = '' + this.dialogForm.idUnitBySale = '' + this.dialogForm.idunitbymanufacture = '' + // this.$refs.dialogForm.clearValidate() + // this.$forceUpdate() + }, + unitcodeChange(val, type) { + console.log(val) + + if (type === '1') { + // this.dialogForm.unitcode = val + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + + const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname + + this.dialogForm.idUnitByStock = unitname + this.dialogForm.idUnitByPurchase = unitname + this.dialogForm.idUnitBySale = unitname + this.dialogForm.idunitbymanufacture = unitname + } + + if (type === '0') { + const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children + + this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') + this.idUnitBvStockArr = t + + const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode + this.dialogForm.unitsubcode = mainUnitCode + this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode + + this.dialogForm.idUnitByStock = mainUnitCode + this.dialogForm.idUnitByPurchase = mainUnitCode + this.dialogForm.idUnitBySale = mainUnitCode + this.dialogForm.idunitbymanufacture = mainUnitCode + } + } + } +} +</script> + +<style scoped lang="scss"> +.custom-tree-node { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-size: 14px; + padding-right: 8px; +} + +//::v-deep .el-checkbox__label { +// width: 55px; +//} +// +.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover { + color: #000 !important; +} +</style> diff --git a/src/views/basicSettings/warehouseList.vue b/src/views/basicSettings/warehouseList.vue index ff3abd7..816e714 100644 --- a/src/views/basicSettings/warehouseList.vue +++ b/src/views/basicSettings/warehouseList.vue @@ -1,466 +1,471 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - - <div style="display:flex"> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=6')" - >瀵煎叆 - </el-button> - <el-button v-waves icon="el-icon-refresh-right" @click="syncERP">鍚屾浠撳簱</el-button> - </div> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="浠撳簱缂栫爜" style="display: flex;"> - <el-input v-model="form.code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浠撳簱鍚嶇О" style="display: flex;"> - <el-input v-model="form.name" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐘舵��" style=" display: flex;"> - <el-select - v-model="form.status" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in statusArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="璐т綅绠$悊" style="display: flex;"> - - <el-select - v-model="form.ishasPosition" - style="width:200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in ishasPositionArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getTSecStckData">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="120" - fixed - label="搴忓彿" - /> - <el-table-column - prop="code" - label="浠撳簱缂栫爜" - sortable="custom" - /> - <el-table-column - prop="name" - label="浠撳簱鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="ishasPosition" - label="鏄惁璐т綅绠$悊" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.ishasPosition==='1'" size="small" type="primary">鏄�</el-tag> - <el-tag v-if="row.ishasPosition==='0'" size="small" type="info">鍚�</el-tag> - </template> - </el-table-column> - <el-table-column - prop="status" - label="鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='0'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='1'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - prop="description" - label="澶囨敞" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description ? row.description : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="data_sources"--> - <!-- label="鏁版嵁鏉ユ簮"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getTSecStckData" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="浠撳簱缂栫爜" prop="stckcode"> - <el-input v-model="dialogForm.stckcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="浠撳簱鍚嶇О" prop="stckname"> - <el-input v-model="dialogForm.stckname" style="width: 200px" /> - </el-form-item> - <el-form-item required label="璐т綅绠$悊"> - <el-radio-group v-model="dialogForm.ishaspostion" style="width: 200px"> - <el-radio label="1">鏄�</el-radio> - <el-radio label="0">鍚�</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.status" style="width: 200px"> - <el-radio label="0">姝e父</el-radio> - <el-radio label="1">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="鎻忚堪"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 490px" /> - </el-form-item> - - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { TSecStckAddUpdate, TSecStckData, TSecStckDelete } from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { SaveSearchWareHouse } from '@/api/ErpSyncMes' - -export default { - name: 'WarehouseList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - code: '', - name: '', - status: '', - ishasPosition: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - statusArr: [ - { code: '0', name: '姝e父' }, - { code: '1', name: '鍋滅敤' } - ], - ishasPositionArr: [ - { code: '0', name: '鍚�' }, - { code: '1', name: '鏄�' } - ], - dialogVisible: false, - dialogForm: { - data_sources: 'MES', - stckcode: '', // - stckname: '', // - ishaspostion: '0', // 0鍚� 1 鏄� - description: '', - status: '0', // 0姝e父 1鍋滅敤 - OperType: '' - }, - operation: '', - dialogFormRules: { - stckcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - stckname: [ - { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getTSecStckData() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getTSecStckData() { - const res = await TSecStckData(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getTSecStckData() - }, - // 閲嶇疆 - reset() { - this.form.code = '' - this.form.name = '' - this.form.status = '' - this.form.ishasPosition = '' - this.getTSecStckData() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - this.$nextTick(() => { - this.dialogForm.stckcode = row.code - this.dialogForm.stckname = row.name - this.dialogForm.status = row.status - this.dialogForm.description = row.description - this.dialogForm.ishaspostion = row.ishasPosition - this.dialogForm.data_sources = row.data_sources - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - TSecStckDelete({ stckcode: row.code, data_sources: row.data_sources }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getTSecStckData() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.data_sources = 'MES' - this.dialogForm.stckcode = '' - this.dialogForm.stckname = '' - this.dialogForm.ishaspostion = '0' - this.dialogForm.description = '' - this.dialogForm.status = '0' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - TSecStckAddUpdate(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getTSecStckData() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - }, - // 鍚屾ERP - syncERP() { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍚屾ERP锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - - SaveSearchWareHouse().then(res => { - if (res.code === '200') { - setTimeout(() => { - this.getTSecStckData() - loading.close() - this.$notify.success('鍚屾鎴愬姛锛�') - }, 2000) - } - // else if (res.code === '300') { - // setTimeout(() => { - // loading.close() - // this.$message.error('鍚屾澶辫触锛�') - // }, 10000) - // } - }).catch(e => { - loading.close() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + + <div style="display:flex"> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=6')" + >瀵煎叆 + </el-button> + <el-button v-waves icon="el-icon-refresh-right" @click="syncERP">鍚屾浠撳簱</el-button> + </div> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="浠撳簱缂栫爜" style="display: flex;"> + <el-input v-model="form.code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浠撳簱鍚嶇О" style="display: flex;"> + <el-input v-model="form.name" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐘舵��" style=" display: flex;"> + <el-select + v-model="form.status" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in statusArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="璐т綅绠$悊" style="display: flex;"> + + <el-select + v-model="form.ishasPosition" + style="width:200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in ishasPositionArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getTSecStckData">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="120" + fixed + label="搴忓彿" + /> + <el-table-column + prop="code" + label="浠撳簱缂栫爜" + sortable="custom" + /> + <el-table-column + prop="name" + label="浠撳簱鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="ishasPosition" + label="鏄惁璐т綅绠$悊" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.ishasPosition==='1'" size="small" type="primary">鏄�</el-tag> + <el-tag v-if="row.ishasPosition==='0'" size="small" type="info">鍚�</el-tag> + </template> + </el-table-column> + <el-table-column + prop="status" + label="鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='0'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='1'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + prop="description" + label="澶囨敞" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description ? row.description : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="data_sources"--> + <!-- label="鏁版嵁鏉ユ簮"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getTSecStckData" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="浠撳簱缂栫爜" prop="stckcode"> + <el-input v-model="dialogForm.stckcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="浠撳簱鍚嶇О" prop="stckname"> + <el-input v-model="dialogForm.stckname" style="width: 200px" /> + </el-form-item> + <el-form-item required label="璐т綅绠$悊"> + <el-radio-group v-model="dialogForm.ishaspostion" style="width: 200px"> + <el-radio label="1">鏄�</el-radio> + <el-radio label="0">鍚�</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.status" style="width: 200px"> + <el-radio label="0">姝e父</el-radio> + <el-radio label="1">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 490px" /> + </el-form-item> + + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { TSecStckAddUpdate, TSecStckData, TSecStckDelete } from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { SaveSearchWareHouse } from '@/api/ErpSyncMes' + +export default { + name: 'WarehouseList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + code: '', + name: '', + status: '', + ishasPosition: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + statusArr: [ + { code: '0', name: '姝e父' }, + { code: '1', name: '鍋滅敤' } + ], + ishasPositionArr: [ + { code: '0', name: '鍚�' }, + { code: '1', name: '鏄�' } + ], + dialogVisible: false, + dialogForm: { + data_sources: 'MES', + stckcode: '', // + stckname: '', // + ishaspostion: '0', // 0鍚� 1 鏄� + description: '', + status: '0', // 0姝e父 1鍋滅敤 + OperType: '' + }, + operation: '', + dialogFormRules: { + stckcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + stckname: [ + { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getTSecStckData() + }, + created() { + this.getTSecStckData() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getTSecStckData() { + const res = await TSecStckData(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getTSecStckData() + }, + // 閲嶇疆 + reset() { + this.form.code = '' + this.form.name = '' + this.form.status = '' + this.form.ishasPosition = '' + this.getTSecStckData() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + this.$nextTick(() => { + this.dialogForm.stckcode = row.code + this.dialogForm.stckname = row.name + this.dialogForm.status = row.status + this.dialogForm.description = row.description + this.dialogForm.ishaspostion = row.ishasPosition + this.dialogForm.data_sources = row.data_sources + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + TSecStckDelete({ stckcode: row.code, data_sources: row.data_sources }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getTSecStckData() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.data_sources = 'MES' + this.dialogForm.stckcode = '' + this.dialogForm.stckname = '' + this.dialogForm.ishaspostion = '0' + this.dialogForm.description = '' + this.dialogForm.status = '0' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + TSecStckAddUpdate(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getTSecStckData() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + }, + // 鍚屾ERP + syncERP() { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍚屾ERP锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + + SaveSearchWareHouse().then(res => { + if (res.code === '200') { + setTimeout(() => { + this.getTSecStckData() + loading.close() + this.$notify.success('鍚屾鎴愬姛锛�') + }, 2000) + } + // else if (res.code === '300') { + // setTimeout(() => { + // loading.close() + // this.$message.error('鍚屾澶辫触锛�') + // }, 10000) + // } + }).catch(e => { + loading.close() + }) + } + } +} +</script> diff --git a/src/views/deviceManager/checkPosition.vue b/src/views/deviceManager/checkPosition.vue index 909181a..3f71e7e 100644 --- a/src/views/deviceManager/checkPosition.vue +++ b/src/views/deviceManager/checkPosition.vue @@ -1,608 +1,613 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.checkitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.checkitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐐规瑕佹眰" style=" display: flex;"> - <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閫変腑鎵爜" style=" display: flex;"> - <el-select v-model="form.isqrcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in isqrcodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐐规鍛ㄦ湡" style=" display: flex;"> - <el-select v-model="form.cycle" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in cycleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> - <div v-else-if="item.prop==='isscan'"> - <div v-if="row[item.prop]==='Y'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鏄� - </div> - <div v-if="row[item.prop]==='N'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 鍚� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <!-- <el-table-column--> - <!-- type="selection"--> - <!-- width="50"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="RowNum"--> - <!-- width="50"--> - <!-- fixed--> - <!-- label="搴忓彿"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="code"--> - <!-- label="閮ㄤ綅缂栫爜"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="name"--> - <!-- label="閮ㄤ綅鍚嶇О"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="description"--> - <!-- label="鐐规瑕佹眰"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.description">{{ row.description }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="isscan"--> - <!-- label="閫夋嫨鎵爜"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.isscan==='Y'">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- 鏄�--> - <!-- </div>--> - <!-- <div v-if="row.isscan==='N'">--> - <!-- <i class="el-icon-info" style="margin-right: 2px" />--> - <!-- 鍚�--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="cycle"--> - <!-- label="鐐规鍛ㄦ湡"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.cycle==='Y'">骞�</div>--> - <!-- <div v-if="row.cycle==='S'">瀛�</div>--> - <!-- <div v-if="row.cycle==='M'">鏈�</div>--> - <!-- <div v-if="row.cycle==='W'">鍛�</div>--> - <!-- <div v-if="row.cycle==='D'">鏃�</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="lm_user"--> - <!-- label="鍒涘缓浜哄憳"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="lm_date"--> - <!-- label="鍒涘缓鏃堕棿"--> - <!-- show-tooltip-when-overflow--> - <!-- width="160"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceCheckItemSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="閮ㄤ綅缂栫爜" prop="checkitemcode"> - <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" prop="checkitemname"> - <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> - </el-form-item> - <el-form-item prop="cycle" label="鐐规鍛ㄦ湡"> - <el-select - v-model="dialogForm.cycle" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in cycleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item prop="isqrcode" label="閫夋嫨鎵爜"> - <el-select - v-model="dialogForm.isqrcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in isqrcodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鐐规瑕佹眰" prop="checkitemdescr"> - <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateDeviceCheckItem, DeleteDeviceCheckItem, DeviceCheckItemSearch } from '@/api/DeviceManager' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'CheckPosition', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - checkitemcode: '', // 閮ㄤ綅缂栫爜 - checkitemname: '', // 閮ㄤ綅鍚嶇О - checkdescr: '', // 鐐规瑕佹眰 - isqrcode: '', // 閫変腑鎵爜 - cycle: '', // 鐐规鍛ㄦ湡 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - isqrcodeArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'Y', name: '骞�' }, - { code: 'S', name: '瀛�' }, - { code: 'M', name: '鏈�' }, - { code: 'W', name: '鍛�' }, - { code: 'D', name: '鏃�' } - ], - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '閮ㄤ綅缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '閮ㄤ綅鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鐐规瑕佹眰', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'isscan', - label: '閫夋嫨鎵爜', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'cycle', - label: '鐐规鍛ㄦ湡', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - id: '', - checkitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 - checkitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О - checkitemdescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 - cycle: 'D', // 璁惧鐐规閮ㄤ綅鍛ㄦ湡 - isqrcode: 'N', // 鏄惁鎵爜 - OperType: '' // 鎿嶄綔绫诲瀷 - }, - operation: '', - dialogFormRules: { - checkitemcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - checkitemname: [ - { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } - ], - cycle: [ - { required: true, message: '', trigger: ['blur', 'change'] } - ], - isqrcode: [ - { required: true, message: '', trigger: ['blur', 'change'] } - ] - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '10', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDeviceCheckItemSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getDeviceCheckItemSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getDeviceCheckItemSearch() { - const res = await DeviceCheckItemSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceCheckItemSearch() - }, - // 鏌ヨ - search() { - this.getDeviceCheckItemSearch() - }, - // 閲嶇疆 - reset() { - this.form.checkitemcode = '' - this.form.checkitemname = '' - this.form.checkdescr = '' - this.form.isqrcode = '' - this.form.cycle = '' - this.getDeviceCheckItemSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.id = row.id - this.dialogForm.cycle = row.cycle - this.dialogForm.isqrcode = row.isscan - this.dialogForm.checkitemcode = row.code - this.dialogForm.checkitemname = row.name - this.dialogForm.checkitemdescr = row.description - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceCheckItem({ checkitemcode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceCheckItemSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.id = '' - this.dialogForm.checkitemcode = '' - this.dialogForm.checkitemname = '' - this.dialogForm.checkitemdescr = '' - this.dialogForm.cycle = 'D' - this.dialogForm.isqrcode = 'N' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - id: this.dialogForm.id, - checkitemcode: this.dialogForm.checkitemcode, - checkitemname: this.dialogForm.checkitemname, - checkitemdescr: this.dialogForm.checkitemdescr, - cycle: this.dialogForm.cycle, - isqrcode: this.dialogForm.isqrcode, - OperType: this.operation === 'add' ? 'Add' : 'Update' - // Operator: getCookie('admin') - } - AddUpdateDeviceCheckItem(data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceCheckItemSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.checkitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.checkitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐐规瑕佹眰" style=" display: flex;"> + <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閫変腑鎵爜" style=" display: flex;"> + <el-select v-model="form.isqrcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in isqrcodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐐规鍛ㄦ湡" style=" display: flex;"> + <el-select v-model="form.cycle" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in cycleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> + <div v-else-if="item.prop==='isscan'"> + <div v-if="row[item.prop]==='Y'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鏄� + </div> + <div v-if="row[item.prop]==='N'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 鍚� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <!-- <el-table-column--> + <!-- type="selection"--> + <!-- width="50"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="RowNum"--> + <!-- width="50"--> + <!-- fixed--> + <!-- label="搴忓彿"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="code"--> + <!-- label="閮ㄤ綅缂栫爜"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="name"--> + <!-- label="閮ㄤ綅鍚嶇О"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="description"--> + <!-- label="鐐规瑕佹眰"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.description">{{ row.description }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="isscan"--> + <!-- label="閫夋嫨鎵爜"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.isscan==='Y'">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- 鏄�--> + <!-- </div>--> + <!-- <div v-if="row.isscan==='N'">--> + <!-- <i class="el-icon-info" style="margin-right: 2px" />--> + <!-- 鍚�--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="cycle"--> + <!-- label="鐐规鍛ㄦ湡"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.cycle==='Y'">骞�</div>--> + <!-- <div v-if="row.cycle==='S'">瀛�</div>--> + <!-- <div v-if="row.cycle==='M'">鏈�</div>--> + <!-- <div v-if="row.cycle==='W'">鍛�</div>--> + <!-- <div v-if="row.cycle==='D'">鏃�</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="lm_user"--> + <!-- label="鍒涘缓浜哄憳"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="lm_date"--> + <!-- label="鍒涘缓鏃堕棿"--> + <!-- show-tooltip-when-overflow--> + <!-- width="160"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceCheckItemSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="閮ㄤ綅缂栫爜" prop="checkitemcode"> + <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" prop="checkitemname"> + <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> + </el-form-item> + <el-form-item prop="cycle" label="鐐规鍛ㄦ湡"> + <el-select + v-model="dialogForm.cycle" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in cycleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item prop="isqrcode" label="閫夋嫨鎵爜"> + <el-select + v-model="dialogForm.isqrcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in isqrcodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鐐规瑕佹眰" prop="checkitemdescr"> + <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateDeviceCheckItem, DeleteDeviceCheckItem, DeviceCheckItemSearch } from '@/api/DeviceManager' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'CheckPosition', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + checkitemcode: '', // 閮ㄤ綅缂栫爜 + checkitemname: '', // 閮ㄤ綅鍚嶇О + checkdescr: '', // 鐐规瑕佹眰 + isqrcode: '', // 閫変腑鎵爜 + cycle: '', // 鐐规鍛ㄦ湡 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + isqrcodeArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'Y', name: '骞�' }, + { code: 'S', name: '瀛�' }, + { code: 'M', name: '鏈�' }, + { code: 'W', name: '鍛�' }, + { code: 'D', name: '鏃�' } + ], + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '閮ㄤ綅缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '閮ㄤ綅鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鐐规瑕佹眰', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'isscan', + label: '閫夋嫨鎵爜', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'cycle', + label: '鐐规鍛ㄦ湡', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + id: '', + checkitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 + checkitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О + checkitemdescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 + cycle: 'D', // 璁惧鐐规閮ㄤ綅鍛ㄦ湡 + isqrcode: 'N', // 鏄惁鎵爜 + OperType: '' // 鎿嶄綔绫诲瀷 + }, + operation: '', + dialogFormRules: { + checkitemcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + checkitemname: [ + { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } + ], + cycle: [ + { required: true, message: '', trigger: ['blur', 'change'] } + ], + isqrcode: [ + { required: true, message: '', trigger: ['blur', 'change'] } + ] + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '10', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDeviceCheckItemSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getDeviceCheckItemSearch() + }, + created() { + this.getDeviceCheckItemSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getDeviceCheckItemSearch() { + const res = await DeviceCheckItemSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceCheckItemSearch() + }, + // 鏌ヨ + search() { + this.getDeviceCheckItemSearch() + }, + // 閲嶇疆 + reset() { + this.form.checkitemcode = '' + this.form.checkitemname = '' + this.form.checkdescr = '' + this.form.isqrcode = '' + this.form.cycle = '' + this.getDeviceCheckItemSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.id = row.id + this.dialogForm.cycle = row.cycle + this.dialogForm.isqrcode = row.isscan + this.dialogForm.checkitemcode = row.code + this.dialogForm.checkitemname = row.name + this.dialogForm.checkitemdescr = row.description + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceCheckItem({ checkitemcode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceCheckItemSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.id = '' + this.dialogForm.checkitemcode = '' + this.dialogForm.checkitemname = '' + this.dialogForm.checkitemdescr = '' + this.dialogForm.cycle = 'D' + this.dialogForm.isqrcode = 'N' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + id: this.dialogForm.id, + checkitemcode: this.dialogForm.checkitemcode, + checkitemname: this.dialogForm.checkitemname, + checkitemdescr: this.dialogForm.checkitemdescr, + cycle: this.dialogForm.cycle, + isqrcode: this.dialogForm.isqrcode, + OperType: this.operation === 'add' ? 'Add' : 'Update' + // Operator: getCookie('admin') + } + AddUpdateDeviceCheckItem(data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceCheckItemSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + } + } +} +</script> diff --git a/src/views/deviceManager/checkRecord.vue b/src/views/deviceManager/checkRecord.vue index bf27a80..7e36a89 100644 --- a/src/views/deviceManager/checkRecord.vue +++ b/src/views/deviceManager/checkRecord.vue @@ -1,595 +1,600 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> - <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm" style="justify-content: flex-start"> - <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> - <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in wkshopSelectArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stanedname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐐规浜哄憳" style=" display: flex;"> - <el-input v-model="form.checkuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐐规鏃堕棿" style=" display: flex;font-size:14px;align-items: center"> - <el-date-picker - v-model="form.checkdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - - <div v-else-if="item.prop==='chk_result'"> - <div v-if="row[item.prop]==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row[item.prop]==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <!-- <div class="operationClass">--> - <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> - <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> - <!-- </el-tooltip>--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i class="el-icon-delete" @click="del(row)" />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceCheckTakeSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'鐐规鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <!-- <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />--> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <!-- <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />--> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - /> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible = false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' -import { getCookie } from '@/utils/auth' -import { handleDatetime } from '@/utils/global' -import { DeviceCheckSubTakeSearch, DeviceCheckTakeOutExcel, DeviceCheckTakeSearch } from '@/api/DeviceManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'CheckRecord', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', // 杞﹂棿缂栫爜 - eqpcode: '', // 璁惧缂栫爜 - eqpname: '', // 璁惧鍚嶇О - stanedname: '', // 鏍囧噯鍚嶇О - checkuser: '', // 鐐规浜哄憳 - checkdate: '', // 鐐规鏃堕棿 - prop: 'chk_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopSelectArr: [], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'djwo', - label: '鐐规鍗曞彿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 130, - prop: 'org_code', - label: '鐢熶骇杞﹂棿缂栫爜', - id: 4, - show: false, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'org_name', - label: '鐢熶骇杞﹂棿', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_code', - label: '璁惧缂栫爜', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_name', - label: '璁惧鍚嶇О', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 130, - prop: 'stanedcode', - label: '鐐规鏍囧噯缂栫爜', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 130, - width: false, - prop: 'stanedname', - label: '鐐规鏍囧噯鍚嶇О', - id: 9, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'chk_user', - label: '鐐规浜哄憳', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'chk_result', - label: '鐐规缁撴灉', - id: 11, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'chk_date', - label: '鐐规鏃堕棿', - id: 12, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - // dialogForm: { - // OrgType: '', - // OrgCode: '', - // OrgName: '', - // SupUnit: ''// 涓婄骇鍗曚綅 - // }, - operation: '', - - tableDataDialog: [], // 鐐规鏄庣粏瀵硅瘽妗唗able - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceCheckTakeSearch().then(res => { - if (res.code === '200') { - this.getShopSearch() - } - }) - }, - async getDeviceCheckTakeSearch() { - let tempDate = this.form.checkdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - wkshopcode: this.form.wkshopcode, - eqpcode: this.form.eqpcode, - eqpname: this.form.eqpname, - stanedname: this.form.stanedname, - checkuser: this.form.checkuser, - checkdate: tempDate, - prop: this.form.prop, // 鎺掑簭瀛楁 - order: this.form.order, // 鎺掑簭瀛楁 - page: this.form.page, // 绗嚑椤� - rows: this.form.rows // 姣忛〉澶氬皯鏉� - } - - const res = await DeviceCheckTakeSearch(data) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 - async getShopSearch() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopSelectArr = res - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceCheckTakeSearch() - }, - // 鏌ヨ - search() { - this.getDeviceCheckTakeSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.eqpcode = '' - this.form.eqpname = '' - this.form.stanedname = '' - this.form.checkuser = '' - this.form.checkdate = '' - this.getDeviceCheckTakeSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await DeviceCheckSubTakeSearch({ djwo: row.djwo }) - - this.tableDataDialog = res.data - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteOrganization({ orgid: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceCheckTakeSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - // this.dialogForm.OrgType = '' - // this.dialogForm.OrgCode = '' - // this.dialogForm.OrgName = '' - // this.dialogForm.SupUnit = '' - // this.$refs.dialogForm.clearValidate() - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - AddUpdateOrganization(data).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getDeviceCheckTakeSearch() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - async download() { - let tempDate = this.form.checkdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, - eqpcode: this.form.eqpcode, - eqpname: this.form.eqpname, - stanedname: this.form.stanedname, - checkuser: this.form.checkuser, - checkdate: tempDate - } - const { data: res } = await DeviceCheckTakeOutExcel(data) - window.location.href = res - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> + <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm" style="justify-content: flex-start"> + <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> + <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in wkshopSelectArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stanedname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐐规浜哄憳" style=" display: flex;"> + <el-input v-model="form.checkuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐐规鏃堕棿" style=" display: flex;font-size:14px;align-items: center"> + <el-date-picker + v-model="form.checkdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + + <div v-else-if="item.prop==='chk_result'"> + <div v-if="row[item.prop]==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row[item.prop]==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <!-- <div class="operationClass">--> + <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> + <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> + <!-- </el-tooltip>--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i class="el-icon-delete" @click="del(row)" />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceCheckTakeSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'鐐规鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <!-- <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />--> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <!-- <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />--> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + /> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible = false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' +import { getCookie } from '@/utils/auth' +import { handleDatetime } from '@/utils/global' +import { DeviceCheckSubTakeSearch, DeviceCheckTakeOutExcel, DeviceCheckTakeSearch } from '@/api/DeviceManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'CheckRecord', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', // 杞﹂棿缂栫爜 + eqpcode: '', // 璁惧缂栫爜 + eqpname: '', // 璁惧鍚嶇О + stanedname: '', // 鏍囧噯鍚嶇О + checkuser: '', // 鐐规浜哄憳 + checkdate: '', // 鐐规鏃堕棿 + prop: 'chk_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopSelectArr: [], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'djwo', + label: '鐐规鍗曞彿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 130, + prop: 'org_code', + label: '鐢熶骇杞﹂棿缂栫爜', + id: 4, + show: false, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'org_name', + label: '鐢熶骇杞﹂棿', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_code', + label: '璁惧缂栫爜', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_name', + label: '璁惧鍚嶇О', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 130, + prop: 'stanedcode', + label: '鐐规鏍囧噯缂栫爜', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 130, + width: false, + prop: 'stanedname', + label: '鐐规鏍囧噯鍚嶇О', + id: 9, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'chk_user', + label: '鐐规浜哄憳', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'chk_result', + label: '鐐规缁撴灉', + id: 11, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'chk_date', + label: '鐐规鏃堕棿', + id: 12, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + // dialogForm: { + // OrgType: '', + // OrgCode: '', + // OrgName: '', + // SupUnit: ''// 涓婄骇鍗曚綅 + // }, + operation: '', + + tableDataDialog: [], // 鐐规鏄庣粏瀵硅瘽妗唗able + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceCheckTakeSearch().then(res => { + if (res.code === '200') { + this.getShopSearch() + } + }) + }, + async getDeviceCheckTakeSearch() { + let tempDate = this.form.checkdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + wkshopcode: this.form.wkshopcode, + eqpcode: this.form.eqpcode, + eqpname: this.form.eqpname, + stanedname: this.form.stanedname, + checkuser: this.form.checkuser, + checkdate: tempDate, + prop: this.form.prop, // 鎺掑簭瀛楁 + order: this.form.order, // 鎺掑簭瀛楁 + page: this.form.page, // 绗嚑椤� + rows: this.form.rows // 姣忛〉澶氬皯鏉� + } + + const res = await DeviceCheckTakeSearch(data) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 + async getShopSearch() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopSelectArr = res + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceCheckTakeSearch() + }, + // 鏌ヨ + search() { + this.getDeviceCheckTakeSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.eqpcode = '' + this.form.eqpname = '' + this.form.stanedname = '' + this.form.checkuser = '' + this.form.checkdate = '' + this.getDeviceCheckTakeSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await DeviceCheckSubTakeSearch({ djwo: row.djwo }) + + this.tableDataDialog = res.data + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteOrganization({ orgid: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceCheckTakeSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + // this.dialogForm.OrgType = '' + // this.dialogForm.OrgCode = '' + // this.dialogForm.OrgName = '' + // this.dialogForm.SupUnit = '' + // this.$refs.dialogForm.clearValidate() + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + AddUpdateOrganization(data).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getDeviceCheckTakeSearch() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + async download() { + let tempDate = this.form.checkdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, + eqpcode: this.form.eqpcode, + eqpname: this.form.eqpname, + stanedname: this.form.stanedname, + checkuser: this.form.checkuser, + checkdate: tempDate + } + const { data: res } = await DeviceCheckTakeOutExcel(data) + window.location.href = res + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + + } +} +</script> + diff --git a/src/views/deviceManager/checkStandard.vue b/src/views/deviceManager/checkStandard.vue index 2a9c5be..0ecc859 100644 --- a/src/views/deviceManager/checkStandard.vue +++ b/src/views/deviceManager/checkStandard.vue @@ -1,1349 +1,1354 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10_1')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐐规绠℃帶" style=" display: flex;"> - <el-select v-model="form.checkcontr" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='is_checkeqp'"> - <i - v-if="row[item.prop]==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - @click="checkeqpClick(row)" - /> - <i - v-if="row[item.prop]==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185)" - @click="checkeqpClick(row)" - /> - </div> - <div v-else-if="item.prop==='iscontr'"> - <div v-if="row[item.prop]==='Y'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鏄� - </div> - <div v-if="row[item.prop]==='N'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 鍚� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - :style="{color:$store.state.settings.theme}" - class="el-icon-edit-outline" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceCheckStandArdSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="8vh" - @closed="handleClose" - > - <!-- @close="handleClose"--> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鐐规鏍囧噯淇℃伅锛� - </div> - <div style="margin: 0 30px;"> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="鏍囧噯缂栫爜" prop="code"> - <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" style="width: 200px" /> - </el-form-item> - <el-form-item required label="鐐规绠℃帶"> - <el-select - v-model="dialogForm.enable" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" prop="description"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - </div> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈鐐规椤逛俊鎭細 - </div> - <div style="margin-bottom:10px"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> - </div> - <div class="elTableDiv"> - <el-table - ref="tableDataDialogRef" - :data="tableDataDialog" - :height="(tableHeight-300)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-300)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - label="搴忓彿" - /> - <el-table-column - prop="checkitem_code" - label="鐐规閮ㄤ綅缂栫爜" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_code }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.checkitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in checkItemSelectArr" - :key="item.name" - :label="item.code" - :value="item.name" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - prop="checkitem_name" - label="鐐规閮ㄤ綅鍚嶇О" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_name }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.checkitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in checkItemSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - - <el-table-column - prop="checkitem_descr" - label="鐐规瑕佹眰" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_descr }}</div> - <el-input v-else v-model="row.checkitem_descr" /> - </template> - </el-table-column> - <el-table-column - prop="isscan" - label="閫夋嫨鎵爜" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.isscan" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - prop="cycle" - label="鐐规鍛ㄦ湡" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.cycle === 'D' ? '鏃�' : '' }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.cycle" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in cycleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> - - <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> - </div> - </template> - </el-table-column> - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- 鍏宠仈璁惧--> - <el-dialog - v-el-drag-dialog - title="鍏宠仈璁惧" - :visible.sync="dialogVisibleEqp" - width="800px" - top="10vh" - :close-on-click-modal="false" - class="dialogVisibleEqp" - @closed="handleCloseEqp" - @close="handleCloseEqp" - > - <!-- @opened="handleOpenedRoles"--> - - <div> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 - </div> - <div class="myCheckboxGroup"> - - <div - v-for="item in dialogFormEqp.eqpArr" - :key="item.code" - :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" - class="myCheckbox" - @click="myCheckboxClick(item)" - > - <!-- <input--> - <!-- class="myCheckboxInput"--> - <!-- type="checkbox"--> - <!-- :value="item.code"--> - <!-- :name="item.name"--> - <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> - <!-- @click="myCheckboxInputClick(item)"--> - <!-- >{{ item.name }}--> - <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> - <!-- onClick="event.cancelBubble = true"--> - - <el-checkbox - :key="item.code" - v-model="item.isSelected2" - class="myCheckboxInput" - :value="item.code" - :name="item.name" - :checked="item.isSelected2" - :label="item.name" - @change="myCheckboxInputClick(item)" - /> - <div class="myCheckboxInputLabel">{{ item.name }}</div> - - </div> - </div> - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� - </div> - <el-tree - ref="epqTree" - :data="dialogFormEqp.eqpTree" - show-checkbox - node-key="code" - default-expand-all - style="height: 320px;overflow: auto" - :props="defaultPropsOfEqpTree" - @check="checkBoxClick" - /> - <!-- @check-change="checkChange"--> - - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="eqpDialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned, - DeviceCheckItemSelect, - DeviceCheckStandArdSearch, DeviceCheckStanedAssociationEqp, SaveDeviceCheckStanedAssociationEqp, - ViewDeviceCheckStanedSearch -} from '@/api/DeviceManager' -import $ from 'jquery' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'CheckStandard', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - checkstandcode: '', // 鏍囧噯缂栫爜 - checkstandname: '', // 鏍囧噯鍚嶇О - checkcontr: '', // 鐐规绠℃帶 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkcontrArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'D', name: '鏃�' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鏍囧噯鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'iscontr', - label: '鐐规绠℃帶', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'is_checkeqp', - label: '鍏宠仈璁惧', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - code: '', - name: '', - enable: 'Y', - description: '' - }, - operation: '', - dialogFormRules: { - - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } - ], - enable: [ - { required: true, message: '', trigger: ['blur', 'change'] } - ] - }, - tableDataDialog: [], // 琛ㄦ牸鏁版嵁 - // tableDataDialogSelected: [], // 宸查�塩ode - checkItemSelectArr: [], - checkItemIsCancel: true, - dialogVisibleEqp: false, - - dialogFormEqp: { - name: '', - code: '', - eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� - eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� - eqpTree: [], // 璁惧鏍戝舰鎵�鏈� - eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 - }, - defaultPropsOfEqpTree: { - value: 'code', - label: 'name', - children: 'children' - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '22', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDeviceCheckStandArdSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceCheckStandArdSearch().then(res => { - if (res.code === '200') { - this.getDeviceCheckItemSelect() - } - }) - }, - async getDeviceCheckStandArdSearch() { - const res = await DeviceCheckStandArdSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceCheckStandArdSearch() - }, - // 鏌ヨ - search() { - this.getDeviceCheckStandArdSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.checkstandcode = '' - this.form.checkstandname = '' - this.form.checkcontr = '' - this.getDeviceCheckStandArdSearch() - }, - - async getDeviceCheckItemSelect() { - const { data: res } = await DeviceCheckItemSelect() - this.checkItemSelectArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - // this.getDeviceCheckItemSelect() - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鎸夐挳 - edit(operation, row) { - // this.getDeviceCheckItemSelect() - this.operation = operation - this.getViewDeviceCheckStanedSearch(row.code) - this.dialogVisible = true - - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - // this.$nextTick(() => { - // this.dialogForm.code = row.code - // this.dialogForm.name = row.name - // this.dialogForm.enable = row.enable - // this.dialogForm.description = row.description - // }) - }, - // 淇敼鍓嶈姹傛帴鍙� - async getViewDeviceCheckStanedSearch(checkstand_code) { - const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code }) - this.tableDataDialog = res.Data - - this.dialogForm.code = res.code - this.dialogForm.name = res.name - this.dialogForm.enable = res.enable - this.dialogForm.description = res.description - - this.tableDataDialog.forEach(item => { - item.isVisible = 0 - item.checkitem_code = item.code - item.checkitem_name = item.name - item.checkitem_descr = item.chkdesc - }) - - this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code)) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceCheckStandArdSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.enable = 'Y' - this.dialogForm.description = '' - this.tableDataDialog = [] - this.getDeviceCheckItemSelect() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - if (this.tableDataDialog.length === 0) { - return this.$message.info('璁惧鍏宠仈鐐规椤逛俊鎭笉鑳戒负绌猴紒') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - // this.tableDataDialog.forEach((item, index) => { // 鍘绘帀姝e湪缂栬緫涓旀槸绌篶heckitem_code - // if (item.isVisible === 1 && item.checkitem_code === '') { - // this.tableDataDialog.splice(index, 1) - // } - // }) - - this.tableDataDialog.filter(item => item.checkitem_code !== '') - - let Data = [] - // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 - Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { - return selfArr.findIndex(item => item.checkitem_code === currentValue.checkitem_code) === currentIndex - }) - Data.forEach((item, index) => { - item.checkitem_seq = index + 1 - }) - - const data = { - 'code': this.dialogForm.code, - 'name': this.dialogForm.name, - 'enable': this.dialogForm.enable, - 'description': this.dialogForm.description, - 'Data': Data - } - - AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceCheckStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - selectChange(val, row) { - const res = this.checkItemSelectArr.find(item => { - return item.code === val || item.name === val - }) - row.checkitem_descr = res.description - row.checkitem_code = res.code - row.checkitem_name = res.name - }, - // 鏂板琛� - addRow() { - let flag = false - this.tableDataDialog.forEach(item => { - if (item.isVisible === 1) { - // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - } - this.tableDataDialog.push({ - checkitem_code: '', - checkitem_name: '', - checkitem_descr: '', - isscan: 'Y', - cycle: 'D', - isVisible: 1 - }) - - this.checkItemIsCancel = false - }, - editRow(row) { - let flag = false - this.tableDataDialog.forEach((item, index) => { - if (item.isVisible === 1) { - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') - } - - this.checkItemIsCancel = false - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code) { - this.tableDataDialog.splice(index, 1, { - checkitem_code: row.checkitem_code, - checkitem_name: row.checkitem_name, - checkitem_descr: row.checkitem_descr, - isscan: row.isscan, - cycle: row.cycle, - isVisible: 1 - }) - } - }) - }, - delRow(row) { - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code) { - this.tableDataDialog.splice(index, 1) - } - }) - }, - saveRow(row) { - if (row.checkitem_code === '' && row.checkitem_name === '') { - return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') - } - row.isVisible = 0 - this.checkItemSelectArr.forEach((item, index) => { - if (item.code === row.checkitem_code) { - this.checkItemSelectArr.splice(index, 1) - } - }) - }, - cancelRow(row) { - // this.checkItemSelectArr.forEach((item, index) => { - // if (item.code === row.checkitem_code) { - if (this.checkItemIsCancel) { - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - } - this.JYIsCancel = true - // } - // }) - - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) { - row.isVisible = 0 - this.tableDataDialog.splice(index, 1) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 鍏宠仈璁惧 - checkeqpClick(row) { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - this.dialogFormEqp.name = row.name - this.dialogFormEqp.code = row.code - - DeviceCheckStanedAssociationEqp({ checkstand_code: row.code }).then(res => { - if (res.code === '200') { - setTimeout(() => { - loading.close() - this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) - - if (this.dialogFormEqp.eqpAll.length > 0) { - this.dialogFormEqp.eqpAll.forEach((item, index) => { - this.dialogFormEqp.eqpArr.push({ - code: item.code, - name: item.name, - type: item.type, - isSelected1: index === 0, - isSelected2: item.flag === 'Y' - }) - if (item.flag === 'Y') { - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (it.flag === 'Y') { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - } - }) - } - }) - this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] - } - - this.dialogVisibleEqp = true - - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, 1000) - } else { - loading.close() - } - }) - }, - // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� - handleCloseEqp() { - this.$refs.epqTree.setCheckedKeys([]) - this.dialogFormEqp.code = '' - this.dialogFormEqp.name = '' - this.dialogFormEqp.eqpAll = [] - this.dialogFormEqp.eqpArr = [] - this.dialogFormEqp.eqpTree = [] - this.dialogFormEqp.eqpCodeSelectedArr = [] - }, - // 澶х洅瀛愮偣鍑� - myCheckboxClick(val) { - this.dialogFormEqp.eqpArr.forEach((item, index) => { - item.isSelected1 = item.code === val.code - if (item.code === val.code) { - this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] - } - }) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, - // 灏忕洅瀛愮偣鍑� - myCheckboxInputClick(val) { - console.log(val) - val.isSelected2 = !!val.isSelected2 - if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 - console.log('浠庢病閫変腑鍒伴�変腑') - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } else { // 浠庨�変腑鍒版病閫変腑 - console.log('浠庨�変腑鍒版病閫変腑') - const temp = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) - }, - // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 - checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { - let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� - console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === obj.code) { - checkedFatherCode = item.code - } - if (item.children && item.children.length > 0) { - item.children.forEach((it, ind) => { - if (it.code === obj.code) { - checkedFatherCode = item.code - } - }) - } - }) - console.log(checkedFatherCode, 1) - - // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { - console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - console.log(item.code, 777) - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { - if (item === obj.code) { - this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) - } - }) - checkedKeys.forEach(item => { - this.dialogFormEqp.eqpCodeSelectedArr.push(item) - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] - } - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 666) - // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 - if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { - console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') - const temp = [] - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = false - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - } - - // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { - console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - } - }, - // 鍙栨秷浜嬩欢 - eqpDialogVisibleCancel() { - this.dialogVisibleEqp = false - }, - // 纭浜嬩欢 - eqpDialogVisibleConfirm() { - // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) - // this.dialogVisibleEqp = false - this.$store.state.app.buttonIsDisabled = true - const data = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { - data.push({ - name: it.name, - code: it.code - }) - } - }) - } - }) - - SaveDeviceCheckStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { - if (res.code === '200') { - this.dialogVisibleEqp = false - this.$notify.success('鍏宠仈鎴愬姛锛�') - this.getDeviceCheckStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } - }) - } - } -} -</script> -<!--鍏叡椤甸潰鏍峰紡--> -<style lang="scss" scoped> -$main_color: #42b983; - -.dialogVisibleEqp { - .myCheckboxGroup { - display: flex; - flex-wrap: wrap; - - .myCheckbox { - //border: 1px solid $main_color; - border: 1px solid #eee; - display: flex; - min-width: 100px; - padding: 10px; - margin: 10px 30px 0 0; - border-radius: 5px; - cursor: default; - position: relative; - - .myCheckboxInput { - margin: 1px 5px 0 0; - cursor: pointer; - } - - .myCheckboxInputLabel { - position: absolute; - left: 29px; - padding: 5px; - top: 6px; - color: transparent; - - } - - } - - //.myCheckbox{ - // border: 1px solid $main_color; - //} - - input[type=checkbox] { - cursor: pointer; - position: relative; - width: 14px; - height: 14px; - font-size: 14px; - } - - input[type=checkbox]::after { - position: absolute; - top: 0; - //color: rgb(130, 35, 35); - color: $main_color; - width: 14px; - height: 14px; - display: inline-block; - visibility: visible; - padding-left: 0px; - text-align: center; - content: ' '; - border-radius: 3px - } - - input[type=checkbox]:checked::after { - //content: "鉁�"; - content: "鈭�"; - color: #fff; - font-size: 12px; - font-weight: bold; - background-color: $main_color; - } - } -} - -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} - -.el-icon-share, .el-icon-delete, .el-icon-edit-outline { - color: $main_color; - cursor: pointer; -} - -.el-icon-edit-outline { - margin-right: 15px; -} - -::v-deep .el-button--primary, .el-button--default, .el-button--info { - height: 34px; - display: flex; - align-items: center; - padding: 0 15px; -} - -::v-deep .el-button--primary { - //background-color: $main_color !important; -} - -::v-deep .el-button--default { - background-color: #f8f8fa; - border: none; -} - -::v-deep .el-input__inner { - height: 34px; - line-height: 34px; - //color: #a7a7a7; -} - -//::v-deep .el-dialog__body { -// padding: 20px 100px !important; -//} -::v-deep .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .dialogVisibleRoles .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .importPickerClass .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .el-dialog__footer { - display: flex; - justify-content: flex-end; -} - -::v-deep .el-table .caret-wrapper { - transform: scale(0.8); -} - -::v-deep .cell { - display: flex; - align-items: center; - justify-content: space-between; -} - -::v-deep .el-table::before { - height: 0; -} - -::v-deep .el-table__body-wrapper { - background-color: #f8f8fa; -} - -::v-deep .el-table__body .el-table__row.hover-row td { - background-color: #eaecef; -} - -::v-deep .el-form--inline .el-form-item__label { - color: #a7a7a7; -} - -.body ::v-deep .el-divider { - border: 1px solid #eee; - width: 99%; - margin: 10px auto; -} - -.body ::v-deep .el-form-item { - margin-bottom: 0; -} - -.userDialogVisible ::v-deep .el-form-item { - margin-bottom: 0; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -.tableFixed { - ::v-deep .el-table__fixed-right { - height: 100% !important; - } - - ::v-deep .el-table__fixed { - height: 100% !important; - } -} -</style> -<style> -.osloading { - font-size: 26px !important; -} - -.el-loading-text { - font-size: 26px !important; -} - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10_1')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐐规绠℃帶" style=" display: flex;"> + <el-select v-model="form.checkcontr" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='is_checkeqp'"> + <i + v-if="row[item.prop]==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + @click="checkeqpClick(row)" + /> + <i + v-if="row[item.prop]==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185)" + @click="checkeqpClick(row)" + /> + </div> + <div v-else-if="item.prop==='iscontr'"> + <div v-if="row[item.prop]==='Y'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鏄� + </div> + <div v-if="row[item.prop]==='N'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 鍚� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + :style="{color:$store.state.settings.theme}" + class="el-icon-edit-outline" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceCheckStandArdSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="8vh" + @closed="handleClose" + > + <!-- @close="handleClose"--> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鐐规鏍囧噯淇℃伅锛� + </div> + <div style="margin: 0 30px;"> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="鏍囧噯缂栫爜" prop="code"> + <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" style="width: 200px" /> + </el-form-item> + <el-form-item required label="鐐规绠℃帶"> + <el-select + v-model="dialogForm.enable" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" prop="description"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + </div> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈鐐规椤逛俊鎭細 + </div> + <div style="margin-bottom:10px"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> + </div> + <div class="elTableDiv"> + <el-table + ref="tableDataDialogRef" + :data="tableDataDialog" + :height="(tableHeight-300)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-300)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + label="搴忓彿" + /> + <el-table-column + prop="checkitem_code" + label="鐐规閮ㄤ綅缂栫爜" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_code }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.checkitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in checkItemSelectArr" + :key="item.name" + :label="item.code" + :value="item.name" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + prop="checkitem_name" + label="鐐规閮ㄤ綅鍚嶇О" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_name }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.checkitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in checkItemSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + + <el-table-column + prop="checkitem_descr" + label="鐐规瑕佹眰" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_descr }}</div> + <el-input v-else v-model="row.checkitem_descr" /> + </template> + </el-table-column> + <el-table-column + prop="isscan" + label="閫夋嫨鎵爜" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.isscan" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + prop="cycle" + label="鐐规鍛ㄦ湡" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.cycle === 'D' ? '鏃�' : '' }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.cycle" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in cycleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> + + <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> + </div> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- 鍏宠仈璁惧--> + <el-dialog + v-el-drag-dialog + title="鍏宠仈璁惧" + :visible.sync="dialogVisibleEqp" + width="800px" + top="10vh" + :close-on-click-modal="false" + class="dialogVisibleEqp" + @closed="handleCloseEqp" + @close="handleCloseEqp" + > + <!-- @opened="handleOpenedRoles"--> + + <div> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 + </div> + <div class="myCheckboxGroup"> + + <div + v-for="item in dialogFormEqp.eqpArr" + :key="item.code" + :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" + class="myCheckbox" + @click="myCheckboxClick(item)" + > + <!-- <input--> + <!-- class="myCheckboxInput"--> + <!-- type="checkbox"--> + <!-- :value="item.code"--> + <!-- :name="item.name"--> + <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> + <!-- @click="myCheckboxInputClick(item)"--> + <!-- >{{ item.name }}--> + <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> + <!-- onClick="event.cancelBubble = true"--> + + <el-checkbox + :key="item.code" + v-model="item.isSelected2" + class="myCheckboxInput" + :value="item.code" + :name="item.name" + :checked="item.isSelected2" + :label="item.name" + @change="myCheckboxInputClick(item)" + /> + <div class="myCheckboxInputLabel">{{ item.name }}</div> + + </div> + </div> + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� + </div> + <el-tree + ref="epqTree" + :data="dialogFormEqp.eqpTree" + show-checkbox + node-key="code" + default-expand-all + style="height: 320px;overflow: auto" + :props="defaultPropsOfEqpTree" + @check="checkBoxClick" + /> + <!-- @check-change="checkChange"--> + + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="eqpDialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned, + DeviceCheckItemSelect, + DeviceCheckStandArdSearch, DeviceCheckStanedAssociationEqp, SaveDeviceCheckStanedAssociationEqp, + ViewDeviceCheckStanedSearch +} from '@/api/DeviceManager' +import $ from 'jquery' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'CheckStandard', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + checkstandcode: '', // 鏍囧噯缂栫爜 + checkstandname: '', // 鏍囧噯鍚嶇О + checkcontr: '', // 鐐规绠℃帶 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkcontrArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'D', name: '鏃�' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鏍囧噯鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'iscontr', + label: '鐐规绠℃帶', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'is_checkeqp', + label: '鍏宠仈璁惧', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + code: '', + name: '', + enable: 'Y', + description: '' + }, + operation: '', + dialogFormRules: { + + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } + ], + enable: [ + { required: true, message: '', trigger: ['blur', 'change'] } + ] + }, + tableDataDialog: [], // 琛ㄦ牸鏁版嵁 + // tableDataDialogSelected: [], // 宸查�塩ode + checkItemSelectArr: [], + checkItemIsCancel: true, + dialogVisibleEqp: false, + + dialogFormEqp: { + name: '', + code: '', + eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� + eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� + eqpTree: [], // 璁惧鏍戝舰鎵�鏈� + eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 + }, + defaultPropsOfEqpTree: { + value: 'code', + label: 'name', + children: 'children' + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '22', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDeviceCheckStandArdSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceCheckStandArdSearch().then(res => { + if (res.code === '200') { + this.getDeviceCheckItemSelect() + } + }) + }, + async getDeviceCheckStandArdSearch() { + const res = await DeviceCheckStandArdSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceCheckStandArdSearch() + }, + // 鏌ヨ + search() { + this.getDeviceCheckStandArdSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.checkstandcode = '' + this.form.checkstandname = '' + this.form.checkcontr = '' + this.getDeviceCheckStandArdSearch() + }, + + async getDeviceCheckItemSelect() { + const { data: res } = await DeviceCheckItemSelect() + this.checkItemSelectArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + // this.getDeviceCheckItemSelect() + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鎸夐挳 + edit(operation, row) { + // this.getDeviceCheckItemSelect() + this.operation = operation + this.getViewDeviceCheckStanedSearch(row.code) + this.dialogVisible = true + + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + // this.$nextTick(() => { + // this.dialogForm.code = row.code + // this.dialogForm.name = row.name + // this.dialogForm.enable = row.enable + // this.dialogForm.description = row.description + // }) + }, + // 淇敼鍓嶈姹傛帴鍙� + async getViewDeviceCheckStanedSearch(checkstand_code) { + const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code }) + this.tableDataDialog = res.Data + + this.dialogForm.code = res.code + this.dialogForm.name = res.name + this.dialogForm.enable = res.enable + this.dialogForm.description = res.description + + this.tableDataDialog.forEach(item => { + item.isVisible = 0 + item.checkitem_code = item.code + item.checkitem_name = item.name + item.checkitem_descr = item.chkdesc + }) + + this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code)) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceCheckStandArdSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.enable = 'Y' + this.dialogForm.description = '' + this.tableDataDialog = [] + this.getDeviceCheckItemSelect() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + if (this.tableDataDialog.length === 0) { + return this.$message.info('璁惧鍏宠仈鐐规椤逛俊鎭笉鑳戒负绌猴紒') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + // this.tableDataDialog.forEach((item, index) => { // 鍘绘帀姝e湪缂栬緫涓旀槸绌篶heckitem_code + // if (item.isVisible === 1 && item.checkitem_code === '') { + // this.tableDataDialog.splice(index, 1) + // } + // }) + + this.tableDataDialog.filter(item => item.checkitem_code !== '') + + let Data = [] + // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 + Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { + return selfArr.findIndex(item => item.checkitem_code === currentValue.checkitem_code) === currentIndex + }) + Data.forEach((item, index) => { + item.checkitem_seq = index + 1 + }) + + const data = { + 'code': this.dialogForm.code, + 'name': this.dialogForm.name, + 'enable': this.dialogForm.enable, + 'description': this.dialogForm.description, + 'Data': Data + } + + AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceCheckStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + selectChange(val, row) { + const res = this.checkItemSelectArr.find(item => { + return item.code === val || item.name === val + }) + row.checkitem_descr = res.description + row.checkitem_code = res.code + row.checkitem_name = res.name + }, + // 鏂板琛� + addRow() { + let flag = false + this.tableDataDialog.forEach(item => { + if (item.isVisible === 1) { + // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + } + this.tableDataDialog.push({ + checkitem_code: '', + checkitem_name: '', + checkitem_descr: '', + isscan: 'Y', + cycle: 'D', + isVisible: 1 + }) + + this.checkItemIsCancel = false + }, + editRow(row) { + let flag = false + this.tableDataDialog.forEach((item, index) => { + if (item.isVisible === 1) { + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') + } + + this.checkItemIsCancel = false + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code) { + this.tableDataDialog.splice(index, 1, { + checkitem_code: row.checkitem_code, + checkitem_name: row.checkitem_name, + checkitem_descr: row.checkitem_descr, + isscan: row.isscan, + cycle: row.cycle, + isVisible: 1 + }) + } + }) + }, + delRow(row) { + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code) { + this.tableDataDialog.splice(index, 1) + } + }) + }, + saveRow(row) { + if (row.checkitem_code === '' && row.checkitem_name === '') { + return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') + } + row.isVisible = 0 + this.checkItemSelectArr.forEach((item, index) => { + if (item.code === row.checkitem_code) { + this.checkItemSelectArr.splice(index, 1) + } + }) + }, + cancelRow(row) { + // this.checkItemSelectArr.forEach((item, index) => { + // if (item.code === row.checkitem_code) { + if (this.checkItemIsCancel) { + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + } + this.JYIsCancel = true + // } + // }) + + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) { + row.isVisible = 0 + this.tableDataDialog.splice(index, 1) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 鍏宠仈璁惧 + checkeqpClick(row) { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + this.dialogFormEqp.name = row.name + this.dialogFormEqp.code = row.code + + DeviceCheckStanedAssociationEqp({ checkstand_code: row.code }).then(res => { + if (res.code === '200') { + setTimeout(() => { + loading.close() + this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) + + if (this.dialogFormEqp.eqpAll.length > 0) { + this.dialogFormEqp.eqpAll.forEach((item, index) => { + this.dialogFormEqp.eqpArr.push({ + code: item.code, + name: item.name, + type: item.type, + isSelected1: index === 0, + isSelected2: item.flag === 'Y' + }) + if (item.flag === 'Y') { + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (it.flag === 'Y') { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + } + }) + } + }) + this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] + } + + this.dialogVisibleEqp = true + + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, 1000) + } else { + loading.close() + } + }) + }, + // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� + handleCloseEqp() { + this.$refs.epqTree.setCheckedKeys([]) + this.dialogFormEqp.code = '' + this.dialogFormEqp.name = '' + this.dialogFormEqp.eqpAll = [] + this.dialogFormEqp.eqpArr = [] + this.dialogFormEqp.eqpTree = [] + this.dialogFormEqp.eqpCodeSelectedArr = [] + }, + // 澶х洅瀛愮偣鍑� + myCheckboxClick(val) { + this.dialogFormEqp.eqpArr.forEach((item, index) => { + item.isSelected1 = item.code === val.code + if (item.code === val.code) { + this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] + } + }) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, + // 灏忕洅瀛愮偣鍑� + myCheckboxInputClick(val) { + console.log(val) + val.isSelected2 = !!val.isSelected2 + if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 + console.log('浠庢病閫変腑鍒伴�変腑') + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } else { // 浠庨�変腑鍒版病閫変腑 + console.log('浠庨�変腑鍒版病閫変腑') + const temp = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) + }, + // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 + checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { + let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� + console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === obj.code) { + checkedFatherCode = item.code + } + if (item.children && item.children.length > 0) { + item.children.forEach((it, ind) => { + if (it.code === obj.code) { + checkedFatherCode = item.code + } + }) + } + }) + console.log(checkedFatherCode, 1) + + // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { + console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + console.log(item.code, 777) + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { + if (item === obj.code) { + this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) + } + }) + checkedKeys.forEach(item => { + this.dialogFormEqp.eqpCodeSelectedArr.push(item) + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] + } + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 666) + // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 + if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { + console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') + const temp = [] + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = false + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + } + + // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { + console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + } + }, + // 鍙栨秷浜嬩欢 + eqpDialogVisibleCancel() { + this.dialogVisibleEqp = false + }, + // 纭浜嬩欢 + eqpDialogVisibleConfirm() { + // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) + // this.dialogVisibleEqp = false + this.$store.state.app.buttonIsDisabled = true + const data = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { + data.push({ + name: it.name, + code: it.code + }) + } + }) + } + }) + + SaveDeviceCheckStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { + if (res.code === '200') { + this.dialogVisibleEqp = false + this.$notify.success('鍏宠仈鎴愬姛锛�') + this.getDeviceCheckStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } + }) + } + } +} +</script> +<!--鍏叡椤甸潰鏍峰紡--> +<style lang="scss" scoped> +$main_color: #42b983; + +.dialogVisibleEqp { + .myCheckboxGroup { + display: flex; + flex-wrap: wrap; + + .myCheckbox { + //border: 1px solid $main_color; + border: 1px solid #eee; + display: flex; + min-width: 100px; + padding: 10px; + margin: 10px 30px 0 0; + border-radius: 5px; + cursor: default; + position: relative; + + .myCheckboxInput { + margin: 1px 5px 0 0; + cursor: pointer; + } + + .myCheckboxInputLabel { + position: absolute; + left: 29px; + padding: 5px; + top: 6px; + color: transparent; + + } + + } + + //.myCheckbox{ + // border: 1px solid $main_color; + //} + + input[type=checkbox] { + cursor: pointer; + position: relative; + width: 14px; + height: 14px; + font-size: 14px; + } + + input[type=checkbox]::after { + position: absolute; + top: 0; + //color: rgb(130, 35, 35); + color: $main_color; + width: 14px; + height: 14px; + display: inline-block; + visibility: visible; + padding-left: 0px; + text-align: center; + content: ' '; + border-radius: 3px + } + + input[type=checkbox]:checked::after { + //content: "鉁�"; + content: "鈭�"; + color: #fff; + font-size: 12px; + font-weight: bold; + background-color: $main_color; + } + } +} + +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} + +.el-icon-share, .el-icon-delete, .el-icon-edit-outline { + color: $main_color; + cursor: pointer; +} + +.el-icon-edit-outline { + margin-right: 15px; +} + +::v-deep .el-button--primary, .el-button--default, .el-button--info { + height: 34px; + display: flex; + align-items: center; + padding: 0 15px; +} + +::v-deep .el-button--primary { + //background-color: $main_color !important; +} + +::v-deep .el-button--default { + background-color: #f8f8fa; + border: none; +} + +::v-deep .el-input__inner { + height: 34px; + line-height: 34px; + //color: #a7a7a7; +} + +//::v-deep .el-dialog__body { +// padding: 20px 100px !important; +//} +::v-deep .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .dialogVisibleRoles .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .importPickerClass .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .el-dialog__footer { + display: flex; + justify-content: flex-end; +} + +::v-deep .el-table .caret-wrapper { + transform: scale(0.8); +} + +::v-deep .cell { + display: flex; + align-items: center; + justify-content: space-between; +} + +::v-deep .el-table::before { + height: 0; +} + +::v-deep .el-table__body-wrapper { + background-color: #f8f8fa; +} + +::v-deep .el-table__body .el-table__row.hover-row td { + background-color: #eaecef; +} + +::v-deep .el-form--inline .el-form-item__label { + color: #a7a7a7; +} + +.body ::v-deep .el-divider { + border: 1px solid #eee; + width: 99%; + margin: 10px auto; +} + +.body ::v-deep .el-form-item { + margin-bottom: 0; +} + +.userDialogVisible ::v-deep .el-form-item { + margin-bottom: 0; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +.tableFixed { + ::v-deep .el-table__fixed-right { + height: 100% !important; + } + + ::v-deep .el-table__fixed { + height: 100% !important; + } +} +</style> +<style> +.osloading { + font-size: 26px !important; +} + +.el-loading-text { + font-size: 26px !important; +} + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/deviceManager/deviceList.vue b/src/views/deviceManager/deviceList.vue index 946ea69..92f6245 100644 --- a/src/views/deviceManager/deviceList.vue +++ b/src/views/deviceManager/deviceList.vue @@ -1,885 +1,891 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div style="display: flex"> - <div style="width: 300px;margin: 10px 10px 0 0;background:#fff"> - - <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> - <div style="display: flex;"> - <div - style="width: 5px;height: 100%;border-radius: 5px;" - :style="{background:$store.state.settings.theme}" - /> - <div style="margin-left: 8px;">璁惧娓呭崟</div> - </div> - - <div style="margin-right:10px"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鏂板" placement="top"> - <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="treeAddClick('add')" /> - </el-tooltip> - </div> - - </div> - - <el-tree - ref="treeLeftRef" - style="padding: 10px;overflow: auto" - :style="{height:(tableHeight+222)+'px'}" - :data="treeLeft" - node-key="code" - highlight-current - :props="defaultPropsLeft" - :default-expand-all="true" - :expand-on-click-node="false" - @node-click="getDeviceMangerSearch" - > - <span slot-scope="{ node, data }" class="custom-tree-node"> - <span v-if="!data.isEdit">{{ data.name }}</span> - <span v-if="!data.isEdit"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="data.code!=='-1'" - class="el-icon-edit" - style="margin-right:10px;color: #999" - @click.stop="treeEditClick(node,data,'edit')" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="data.code!=='-1'" - class="el-icon-delete" - style="margin-right: 4px;color: #999" - @click.stop="treeDeleteClick(node,data)" - /> - </el-tooltip> - </span> - </span> - </el-tree> - </div> - - <div - style=" width:calc(100% - 300px);" - > - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=9')" - >瀵煎叆 - </el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.devicecode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.devicename" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <!-- <el-form-item label="浣跨敤鐘舵��" style=" display: flex;">--> - <!-- <el-select--> - <!-- v-model="form.status"--> - <!-- style="width: 100%;"--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in statusArr"--> - <!-- :key="item.code"--> - <!-- :label="item.name"--> - <!-- :value="item.code"--> - <!-- />--> - <!-- </el-select>--> - <!-- </el-form-item>--> - <el-form-item label="鎵�灞炵粍缁�" style=" display: flex;"> - <el-cascader - ref="cascader" - v-model="form.storgcode" - :options="cascaderOptions" - filterable - :props="defaultProps" - :show-all-levels="false" - /> - </el-form-item> - <!-- <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> - <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button - v-waves - type="primary" - icon="el-icon-search" - @click="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())" - >鏌ヨ - </el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height: 5px;" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- prop="RowNum"--> - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="code" - label="璁惧缂栫爜" - sortable="custom" - /> - <el-table-column - prop="name" - label="璁惧鍚嶇О" - - sortable="custom" - /> - <el-table-column - prop="eqptype_name" - label="璁惧绫诲瀷" - sortable="custom" - /> - <el-table-column - prop="torg_name" - label="鎵�灞炵粍缁�" - sortable="custom" - /> - <el-table-column - prop="enable" - label="浣跨敤鐘舵��" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.enable==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.enable==='N'" size="small" type="danger">鍋滅敤</el-tag> - </template> - </el-table-column> - <el-table-column - label="鍒涘缓浜哄憳" - prop="lm_user" - sortable="custom" - width="110" - /> - <el-table-column - label="鍒涘缓鏃堕棿" - prop="lm_date" - sortable="custom" - width="160" - /> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP棰勮" placement="top"> - <i - v-if="mesSetting.device" - class="el-icon-files" - style="cursor: pointer;color:#42b983;margin-right: 15px" - @click="pre(row)" - /> - </el-tooltip> - - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())" - /> - - </div> - </div> - </div> - - <!-- 璁惧绫诲埆鏂板淇敼--> - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogClassVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClassClose" - @close="handleClassClose" - > - <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px"> - <el-form-item label="璁惧绫诲瀷缂栫爜" prop="code"> - <el-input v-model="dialogClassForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧绫诲瀷鍚嶇О" prop="name"> - <el-input v-model="dialogClassForm.name" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleClassConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- 璁惧娓呭崟鏂板淇敼--> - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> - <el-form-item label="璁惧缂栫爜" prop="devicecode"> - <el-input v-model="dialogForm.devicecode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧鍚嶇О" prop="devicename"> - <el-input v-model="dialogForm.devicename" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧绫诲瀷" prop="devicetypecode"> - <el-select - v-model="dialogForm.devicetypecode" - style="width:200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - > - <el-option - v-for="item in treeLeftArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鎵�灞炵粍缁�" prop="storgcode"> - <el-cascader - ref="dialogCascader" - v-model="dialogForm.storgcode" - :options="cascaderOptions" - filterable - style="width: 200px;" - :props="defaultProps" - :show-all-levels="false" - /> - </el-form-item> - <el-form-item required label="鐘舵��"> - <el-radio-group v-model="dialogForm.status"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鍋滅敤</el-radio> - </el-radio-group> - </el-form-item> - - </el-form> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- sop棰勮--> - <el-dialog - v-el-drag-dialog - title="璁惧SOP棰勮" - :visible.sync="SopDialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleSopClose" - @close="handleSopClose" - > - - <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px"> - <el-form-item label="璁惧SOP"> - <el-select - v-model="dialogSopForm.sop" - style="width:200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="sopChange" - > - <el-option - v-for="item in sopArr" - :key="item.filepath" - :label="item.filename" - :value="item.filepath" - /> - </el-select> - </el-form-item> - - <el-form-item label="Sop鐗堟湰"> - <el-input v-model="dialogSopForm.v" disabled style="width: 200px" /> - </el-form-item> - </el-form> - - <el-button - v-waves - type="primary" - style="margin-left: 37px" - @click="view" - >棰� 瑙�/涓� 杞�</el-button> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="handleSopClose">鍙� 娑�</el-button> - <!-- <el-button--> - <!-- v-waves--> - <!-- type="primary"--> - <!-- :loading="$store.state.app.buttonIsDisabled"--> - <!-- :disabled="$store.state.app.buttonIsDisabled"--> - <!-- @click="handleSopConfirm"--> - <!-- >纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import waves from '@/directive/waves' -import Pagination from '@/components/Pagination' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import arrayToTree from 'array-to-tree' -import { PrentOrganization } from '@/api/GeneralBasicData' -import { - AddUpdateDeviceManger, - AddUpdateDeviceType, DeleteDeviceManger, - DeleteDeviceType, - DeviceMangerSearch, DeviceSopSearch, - DeviceTypeSearch -} from '@/api/DeviceManager' - -export default { - name: 'DeviceList', - directives: { waves, elDragDialog }, - components: { - Pagination - }, - data() { - return { - mesSetting: JSON.parse(localStorage.getItem('mesSetting')), - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - operation: '', - - treeLeft: [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ], // 宸︿晶鏍� - treeLeftArr: [], - defaultPropsLeft: { - children: 'children', - label: 'name' - }, - - tableData: [], - form: { - devicetype: '', - devicecode: '', - devicename: '', - status: '', - storgcode: '', - page: 1, - rows: 20, - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc' // 鎺掑簭瀛楁 - }, - total: 0, - - statusArr: [ - { code: '0', name: '姝e父' }, - { code: '1', name: '鍋滅敤' } - ], - defaultProps: { - checkStrictly: true, - expandTrigger: 'hover', - value: 'torg_code', - label: 'torg_name' - }, - Options: [], - cascaderOptions: [], - - dialogClassVisible: false, - dialogClassForm: { - code: '', // 璁惧绫诲瀷缂栫爜 - name: '', // 璁惧鍚嶇О鍚嶇О - OperType: ''// OperType - }, - dialogClassFormRules: { - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭璁惧绫诲瀷鍚嶇О', trigger: ['blur', 'change'] } - ] - }, - - dialogVisible: false, - dialogForm: { - devicecode: '', // 璁惧缂栫爜 - devicename: '', // 璁惧鍚嶇О - devicetypecode: '', // 璁惧绫诲瀷缂栫爜 - storgcode: [], // 缁勭粐缂栫爜 - status: 'Y', // 浣跨敤鐘舵��: 姝e父(Y)鍋滅敤(N) - OperType: '' // 鎿嶄綔绫诲瀷 - }, - dialogFormRules: { - devicecode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - devicename: [ - { required: true, message: '璇疯緭鍏ヨ澶囧悕绉�', trigger: ['blur', 'change'] } - ], - devicetypecode: [ - { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } - ], - storgcode: [ - { required: true, message: '璇烽�夋嫨鎵�灞炵粍缁�', trigger: ['blur', 'change'] } - ] - }, - - SopDialogVisible: false, - dialogSopForm: { // 璁惧SOP琛ㄥ崟 - sop: '', - v: '' - }, - sopArr: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getDeviceTypeSearch() - this.getPrentOrganization() - }, - methods: { - // 寮瑰嚭妗嗗叧闂� - handleSopClose() { - this.SopDialogVisible = false - this.dialogSopForm = { // 璁惧SOP琛ㄥ崟 - sop: '', - v: '' - } - }, - // 棰勮 - view() { - window.open(process.env.VUE_APP_BASE_API_FILE + this.dialogSopForm.sop) - }, - // sop棰勮 - async pre(row) { - const data = { - eqptypecode: row.eqptype_code, - eqpcode: row.code - } - const { data: res } = await DeviceSopSearch(data) - this.sopArr = res - - this.SopDialogVisible = true - }, - sopChange(val) { - this.dialogSopForm.v = this.sopArr.find(i => i.filepath === val).version - }, - async getDeviceTypeSearch() { - const res = await DeviceTypeSearch() - res.data.forEach(i => { - i.idparent = i.idparent ? i.idparent : '-1' - }) - this.treeLeftArr = res.data - this.treeLeftArr.forEach(e => { - e.name = e.code + ' ' + e.name - }) - this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), { - parentProperty: 'idparent', - customID: 'code', - childrenProperty: 'children' - }) - - this.$nextTick(() => { - this.$refs.treeLeftRef.setCurrentKey('-1') - this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) - }) - }, - async getDeviceMangerSearch(node) { - this.form.storgcode = this.form.storgcode ? this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1] : '' - this.form.devicetype = node.code !== '-1' ? node.code : '' - const res = await DeviceMangerSearch(this.form) - - this.tableData = res.data - this.total = res.count - }, - // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� - async getPrentOrganization() { - const { data: res } = await PrentOrganization() - this.Options = res - this.cascaderOptions = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'torg_code', - childrenProperty: 'children' - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 280 - this.$refs.tableDataRef.doLayout() - }) - }, - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - this.dialogForm.devicecode = row.code - this.dialogForm.devicename = row.name - this.dialogForm.status = row.enable - this.dialogForm.devicetypecode = row.eqptype_code - this.dialogForm.storgcode = this.findParent([], row.torg_code, this.cascaderOptions).reverse() - }) - }, - // parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁 - findParent(parents, childNode, treeData) { - // console.log(parents, childNode, treeData, 2) - for (let i = 0; i < treeData.length; i++) { - // 鐖惰妭鐐规煡璇㈡潯浠� - if (treeData[i].torg_code === childNode) { - // 濡傛灉鎵惧埌缁撴灉,淇濆瓨褰撳墠鑺傜偣 - parents.push(treeData[i].torg_code) - // 鐢ㄥ綋鍓嶈妭鐐瑰啀鍘诲師鏁版嵁鏌ユ壘褰撳墠鑺傜偣鐨勭埗鑺傜偣 - this.findParent(parents, treeData[i].parent_id, this.cascaderOptions) - break - } else { - if (treeData[i].children instanceof Array) { - // 娌℃壘鍒帮紝閬嶅巻璇ヨ妭鐐圭殑瀛愯妭鐐� - this.findParent(parents, childNode, treeData[i].children) - } - } - } - return parents - }, - del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceManger({ devicecode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - reset() { - // this.form.storgcode = '' - this.form.devicecode = '' - this.form.devicename = '' - this.form.status = '' - this.form.devicetype = '' - this.$refs.cascader.checkedValue = [] - this.$refs.treeLeftRef.setCurrentKey('-1') - this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.devicecode = '' - this.dialogForm.devicename = '' - // this.dialogForm.storgcode = [] - this.dialogForm.devicetypecode = '' - this.dialogForm.status = 'Y' - this.$refs.dialogCascader.checkedValue = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.dialogForm.storgcode = this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1] - this.$store.state.app.buttonIsDisabled = true - AddUpdateDeviceManger(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - treeEditClick(node, data, operation) { - this.dialogClassForm.code = data.code - this.dialogClassForm.name = data.name.split(' ')[1] - this.dialogClassForm.OperType = 'Update' - this.operation = operation - this.dialogClassVisible = true - }, - treeDeleteClick(node, data) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceType({ devicetypecode: data.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getDeviceTypeSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - treeAddClick(operation) { - this.operation = operation - this.dialogClassVisible = true - this.dialogClassForm.OperType = 'Add' - }, - - handleClassClose() { - this.dialogClassForm.code = '' - this.dialogClassForm.name = '' - this.$refs.dialogClassForm.clearValidate() - }, - dialogVisibleClassCancel() { - this.dialogClassVisible = false - }, - dialogVisibleClassConfirm() { - this.$refs.dialogClassForm.validate(valid => { - if (valid) { - const data = [{ - code: this.dialogClassForm.code, - name: this.dialogClassForm.name, - group: '', - description: '' - }] - AddUpdateDeviceType(data, this.dialogClassForm.OperType) - .then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogClassVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getDeviceTypeSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - unittypcodeChange(val) { - console.log(val) - - this.dialogForm.unitcode = '' - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - this.dialogForm.idUnitByStock = '' - this.dialogForm.idUnitByPurchase = '' - this.dialogForm.idUnitBySale = '' - this.dialogForm.idunitbymanufacture = '' - // this.$refs.dialogForm.clearValidate() - // this.$forceUpdate() - }, - unitcodeChange(val, type) { - console.log(val) - - if (type === '1') { - // this.dialogForm.unitcode = val - this.dialogForm.unitsubcode = '' - this.dialogForm.idSubUnitByReport = '' - - const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname - - this.dialogForm.idUnitByStock = unitname - this.dialogForm.idUnitByPurchase = unitname - this.dialogForm.idUnitBySale = unitname - this.dialogForm.idunitbymanufacture = unitname - } - - if (type === '0') { - const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children - - this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') - this.idUnitBvStockArr = t - - const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode - this.dialogForm.unitsubcode = mainUnitCode - this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode - - this.dialogForm.idUnitByStock = mainUnitCode - this.dialogForm.idUnitByPurchase = mainUnitCode - this.dialogForm.idUnitBySale = mainUnitCode - this.dialogForm.idunitbymanufacture = mainUnitCode - } - } - } -} -</script> - -<style scoped lang="scss"> -.custom-tree-node { - flex: 1; - display: flex; - align-items: center; - justify-content: space-between; - font-size: 14px; - padding-right: 8px; -} - -//::v-deep .el-checkbox__label { -// width: 55px; -//} -// -.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover { - color: #000 !important; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div style="display: flex"> + <div style="width: 300px;margin: 10px 10px 0 0;background:#fff"> + + <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> + <div style="display: flex;"> + <div + style="width: 5px;height: 100%;border-radius: 5px;" + :style="{background:$store.state.settings.theme}" + /> + <div style="margin-left: 8px;">璁惧娓呭崟</div> + </div> + + <div style="margin-right:10px"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鏂板" placement="top"> + <i class="el-icon-plus" style="cursor: pointer;color: #999" @click="treeAddClick('add')" /> + </el-tooltip> + </div> + + </div> + + <el-tree + ref="treeLeftRef" + style="padding: 10px;overflow: auto" + :style="{height:(tableHeight+222)+'px'}" + :data="treeLeft" + node-key="code" + highlight-current + :props="defaultPropsLeft" + :default-expand-all="true" + :expand-on-click-node="false" + @node-click="getDeviceMangerSearch" + > + <span slot-scope="{ node, data }" class="custom-tree-node"> + <span v-if="!data.isEdit">{{ data.name }}</span> + <span v-if="!data.isEdit"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="data.code!=='-1'" + class="el-icon-edit" + style="margin-right:10px;color: #999" + @click.stop="treeEditClick(node,data,'edit')" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="data.code!=='-1'" + class="el-icon-delete" + style="margin-right: 4px;color: #999" + @click.stop="treeDeleteClick(node,data)" + /> + </el-tooltip> + </span> + </span> + </el-tree> + </div> + + <div + style=" width:calc(100% - 300px);" + > + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=9')" + >瀵煎叆 + </el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.devicecode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.devicename" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <!-- <el-form-item label="浣跨敤鐘舵��" style=" display: flex;">--> + <!-- <el-select--> + <!-- v-model="form.status"--> + <!-- style="width: 100%;"--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in statusArr"--> + <!-- :key="item.code"--> + <!-- :label="item.name"--> + <!-- :value="item.code"--> + <!-- />--> + <!-- </el-select>--> + <!-- </el-form-item>--> + <el-form-item label="鎵�灞炵粍缁�" style=" display: flex;"> + <el-cascader + ref="cascader" + v-model="form.storgcode" + :options="cascaderOptions" + filterable + :props="defaultProps" + :show-all-levels="false" + /> + </el-form-item> + <!-- <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛缂栫爜" style=" display: flex;">--> + <!-- <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <!-- <el-form-item v-show="isExpandForm" label="鐢ㄦ埛鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button + v-waves + type="primary" + icon="el-icon-search" + @click="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())" + >鏌ヨ + </el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height: 5px;" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- prop="RowNum"--> + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="code" + label="璁惧缂栫爜" + sortable="custom" + /> + <el-table-column + prop="name" + label="璁惧鍚嶇О" + + sortable="custom" + /> + <el-table-column + prop="eqptype_name" + label="璁惧绫诲瀷" + sortable="custom" + /> + <el-table-column + prop="torg_name" + label="鎵�灞炵粍缁�" + sortable="custom" + /> + <el-table-column + prop="enable" + label="浣跨敤鐘舵��" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.enable==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.enable==='N'" size="small" type="danger">鍋滅敤</el-tag> + </template> + </el-table-column> + <el-table-column + label="鍒涘缓浜哄憳" + prop="lm_user" + sortable="custom" + width="110" + /> + <el-table-column + label="鍒涘缓鏃堕棿" + prop="lm_date" + sortable="custom" + width="160" + /> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP棰勮" placement="top"> + <i + v-if="mesSetting.device" + class="el-icon-files" + style="cursor: pointer;color:#42b983;margin-right: 15px" + @click="pre(row)" + /> + </el-tooltip> + + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())" + /> + + </div> + </div> + </div> + + <!-- 璁惧绫诲埆鏂板淇敼--> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogClassVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClassClose" + @close="handleClassClose" + > + <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px"> + <el-form-item label="璁惧绫诲瀷缂栫爜" prop="code"> + <el-input v-model="dialogClassForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧绫诲瀷鍚嶇О" prop="name"> + <el-input v-model="dialogClassForm.name" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleClassCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleClassConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- 璁惧娓呭崟鏂板淇敼--> + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> + <el-form-item label="璁惧缂栫爜" prop="devicecode"> + <el-input v-model="dialogForm.devicecode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧鍚嶇О" prop="devicename"> + <el-input v-model="dialogForm.devicename" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧绫诲瀷" prop="devicetypecode"> + <el-select + v-model="dialogForm.devicetypecode" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + > + <el-option + v-for="item in treeLeftArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鎵�灞炵粍缁�" prop="storgcode"> + <el-cascader + ref="dialogCascader" + v-model="dialogForm.storgcode" + :options="cascaderOptions" + filterable + style="width: 200px;" + :props="defaultProps" + :show-all-levels="false" + /> + </el-form-item> + <el-form-item required label="鐘舵��"> + <el-radio-group v-model="dialogForm.status"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鍋滅敤</el-radio> + </el-radio-group> + </el-form-item> + + </el-form> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- sop棰勮--> + <el-dialog + v-el-drag-dialog + title="璁惧SOP棰勮" + :visible.sync="SopDialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleSopClose" + @close="handleSopClose" + > + + <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px"> + <el-form-item label="璁惧SOP"> + <el-select + v-model="dialogSopForm.sop" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="sopChange" + > + <el-option + v-for="item in sopArr" + :key="item.filepath" + :label="item.filename" + :value="item.filepath" + /> + </el-select> + </el-form-item> + + <el-form-item label="Sop鐗堟湰"> + <el-input v-model="dialogSopForm.v" disabled style="width: 200px" /> + </el-form-item> + </el-form> + + <el-button + v-waves + type="primary" + style="margin-left: 37px" + @click="view" + >棰� 瑙�/涓� 杞�</el-button> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="handleSopClose">鍙� 娑�</el-button> + <!-- <el-button--> + <!-- v-waves--> + <!-- type="primary"--> + <!-- :loading="$store.state.app.buttonIsDisabled"--> + <!-- :disabled="$store.state.app.buttonIsDisabled"--> + <!-- @click="handleSopConfirm"--> + <!-- >纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import waves from '@/directive/waves' +import Pagination from '@/components/Pagination' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import arrayToTree from 'array-to-tree' +import { PrentOrganization } from '@/api/GeneralBasicData' +import { + AddUpdateDeviceManger, + AddUpdateDeviceType, DeleteDeviceManger, + DeleteDeviceType, + DeviceMangerSearch, DeviceSopSearch, + DeviceTypeSearch +} from '@/api/DeviceManager' + +export default { + name: 'DeviceList', + directives: { waves, elDragDialog }, + components: { + Pagination + }, + data() { + return { + mesSetting: JSON.parse(localStorage.getItem('mesSetting')), + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + operation: '', + + treeLeft: [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ], // 宸︿晶鏍� + treeLeftArr: [], + defaultPropsLeft: { + children: 'children', + label: 'name' + }, + + tableData: [], + form: { + devicetype: '', + devicecode: '', + devicename: '', + status: '', + storgcode: '', + page: 1, + rows: 20, + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc' // 鎺掑簭瀛楁 + }, + total: 0, + + statusArr: [ + { code: '0', name: '姝e父' }, + { code: '1', name: '鍋滅敤' } + ], + defaultProps: { + checkStrictly: true, + expandTrigger: 'hover', + value: 'torg_code', + label: 'torg_name' + }, + Options: [], + cascaderOptions: [], + + dialogClassVisible: false, + dialogClassForm: { + code: '', // 璁惧绫诲瀷缂栫爜 + name: '', // 璁惧鍚嶇О鍚嶇О + OperType: ''// OperType + }, + dialogClassFormRules: { + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭璁惧绫诲瀷鍚嶇О', trigger: ['blur', 'change'] } + ] + }, + + dialogVisible: false, + dialogForm: { + devicecode: '', // 璁惧缂栫爜 + devicename: '', // 璁惧鍚嶇О + devicetypecode: '', // 璁惧绫诲瀷缂栫爜 + storgcode: [], // 缁勭粐缂栫爜 + status: 'Y', // 浣跨敤鐘舵��: 姝e父(Y)鍋滅敤(N) + OperType: '' // 鎿嶄綔绫诲瀷 + }, + dialogFormRules: { + devicecode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + devicename: [ + { required: true, message: '璇疯緭鍏ヨ澶囧悕绉�', trigger: ['blur', 'change'] } + ], + devicetypecode: [ + { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } + ], + storgcode: [ + { required: true, message: '璇烽�夋嫨鎵�灞炵粍缁�', trigger: ['blur', 'change'] } + ] + }, + + SopDialogVisible: false, + dialogSopForm: { // 璁惧SOP琛ㄥ崟 + sop: '', + v: '' + }, + sopArr: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getDeviceTypeSearch() + this.getPrentOrganization() + }, + created() { + + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getDeviceTypeSearch() + this.getPrentOrganization() + }, + methods: { + // 寮瑰嚭妗嗗叧闂� + handleSopClose() { + this.SopDialogVisible = false + this.dialogSopForm = { // 璁惧SOP琛ㄥ崟 + sop: '', + v: '' + } + }, + // 棰勮 + view() { + window.open(process.env.VUE_APP_BASE_API_FILE + this.dialogSopForm.sop) + }, + // sop棰勮 + async pre(row) { + const data = { + eqptypecode: row.eqptype_code, + eqpcode: row.code + } + const { data: res } = await DeviceSopSearch(data) + this.sopArr = res + + this.SopDialogVisible = true + }, + sopChange(val) { + this.dialogSopForm.v = this.sopArr.find(i => i.filepath === val).version + }, + async getDeviceTypeSearch() { + const res = await DeviceTypeSearch() + res.data.forEach(i => { + i.idparent = i.idparent ? i.idparent : '-1' + }) + this.treeLeftArr = res.data + this.treeLeftArr.forEach(e => { + e.name = e.code + ' ' + e.name + }) + this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), { + parentProperty: 'idparent', + customID: 'code', + childrenProperty: 'children' + }) + + this.$nextTick(() => { + this.$refs.treeLeftRef.setCurrentKey('-1') + this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) + }) + }, + async getDeviceMangerSearch(node) { + this.form.storgcode = this.form.storgcode ? this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1] : '' + this.form.devicetype = node.code !== '-1' ? node.code : '' + const res = await DeviceMangerSearch(this.form) + + this.tableData = res.data + this.total = res.count + }, + // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣� + async getPrentOrganization() { + const { data: res } = await PrentOrganization() + this.Options = res + this.cascaderOptions = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'torg_code', + childrenProperty: 'children' + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 280 + this.$refs.tableDataRef.doLayout() + }) + }, + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + this.dialogForm.devicecode = row.code + this.dialogForm.devicename = row.name + this.dialogForm.status = row.enable + this.dialogForm.devicetypecode = row.eqptype_code + this.dialogForm.storgcode = this.findParent([], row.torg_code, this.cascaderOptions).reverse() + }) + }, + // parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁 + findParent(parents, childNode, treeData) { + // console.log(parents, childNode, treeData, 2) + for (let i = 0; i < treeData.length; i++) { + // 鐖惰妭鐐规煡璇㈡潯浠� + if (treeData[i].torg_code === childNode) { + // 濡傛灉鎵惧埌缁撴灉,淇濆瓨褰撳墠鑺傜偣 + parents.push(treeData[i].torg_code) + // 鐢ㄥ綋鍓嶈妭鐐瑰啀鍘诲師鏁版嵁鏌ユ壘褰撳墠鑺傜偣鐨勭埗鑺傜偣 + this.findParent(parents, treeData[i].parent_id, this.cascaderOptions) + break + } else { + if (treeData[i].children instanceof Array) { + // 娌℃壘鍒帮紝閬嶅巻璇ヨ妭鐐圭殑瀛愯妭鐐� + this.findParent(parents, childNode, treeData[i].children) + } + } + } + return parents + }, + del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceManger({ devicecode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + reset() { + // this.form.storgcode = '' + this.form.devicecode = '' + this.form.devicename = '' + this.form.status = '' + this.form.devicetype = '' + this.$refs.cascader.checkedValue = [] + this.$refs.treeLeftRef.setCurrentKey('-1') + this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.devicecode = '' + this.dialogForm.devicename = '' + // this.dialogForm.storgcode = [] + this.dialogForm.devicetypecode = '' + this.dialogForm.status = 'Y' + this.$refs.dialogCascader.checkedValue = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.dialogForm.storgcode = this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1] + this.$store.state.app.buttonIsDisabled = true + AddUpdateDeviceManger(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getDeviceMangerSearch(this.$refs.treeLeftRef.getCurrentNode()) + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + treeEditClick(node, data, operation) { + this.dialogClassForm.code = data.code + this.dialogClassForm.name = data.name.split(' ')[1] + this.dialogClassForm.OperType = 'Update' + this.operation = operation + this.dialogClassVisible = true + }, + treeDeleteClick(node, data) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceType({ devicetypecode: data.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getDeviceTypeSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + treeAddClick(operation) { + this.operation = operation + this.dialogClassVisible = true + this.dialogClassForm.OperType = 'Add' + }, + + handleClassClose() { + this.dialogClassForm.code = '' + this.dialogClassForm.name = '' + this.$refs.dialogClassForm.clearValidate() + }, + dialogVisibleClassCancel() { + this.dialogClassVisible = false + }, + dialogVisibleClassConfirm() { + this.$refs.dialogClassForm.validate(valid => { + if (valid) { + const data = [{ + code: this.dialogClassForm.code, + name: this.dialogClassForm.name, + group: '', + description: '' + }] + AddUpdateDeviceType(data, this.dialogClassForm.OperType) + .then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogClassVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getDeviceTypeSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + unittypcodeChange(val) { + console.log(val) + + this.dialogForm.unitcode = '' + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + this.dialogForm.idUnitByStock = '' + this.dialogForm.idUnitByPurchase = '' + this.dialogForm.idUnitBySale = '' + this.dialogForm.idunitbymanufacture = '' + // this.$refs.dialogForm.clearValidate() + // this.$forceUpdate() + }, + unitcodeChange(val, type) { + console.log(val) + + if (type === '1') { + // this.dialogForm.unitcode = val + this.dialogForm.unitsubcode = '' + this.dialogForm.idSubUnitByReport = '' + + const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname + + this.dialogForm.idUnitByStock = unitname + this.dialogForm.idUnitByPurchase = unitname + this.dialogForm.idUnitBySale = unitname + this.dialogForm.idunitbymanufacture = unitname + } + + if (type === '0') { + const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children + + this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') + this.idUnitBvStockArr = t + + const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode + this.dialogForm.unitsubcode = mainUnitCode + this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode + + this.dialogForm.idUnitByStock = mainUnitCode + this.dialogForm.idUnitByPurchase = mainUnitCode + this.dialogForm.idUnitBySale = mainUnitCode + this.dialogForm.idunitbymanufacture = mainUnitCode + } + } + } +} +</script> + +<style scoped lang="scss"> +.custom-tree-node { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-size: 14px; + padding-right: 8px; +} + +//::v-deep .el-checkbox__label { +// width: 55px; +//} +// +.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover { + color: #000 !important; +} +</style> diff --git a/src/views/deviceManager/maintainPosition.vue b/src/views/deviceManager/maintainPosition.vue index 036d04f..72c3b64 100644 --- a/src/views/deviceManager/maintainPosition.vue +++ b/src/views/deviceManager/maintainPosition.vue @@ -1,526 +1,531 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.maiitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.maiitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="淇濆吇瑕佹眰" style=" display: flex;"> - <el-input v-model="form.maidescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閫変腑鎵爜" style=" display: flex;"> - <el-select v-model="form.isqrcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in isqrcodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- <el-table-column--> - <!-- type="selection"--> - <!-- width="50"--> - <!-- />--> - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> - <div v-else-if="item.prop==='isscan'"> - <div v-if="row[item.prop]==='Y'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鏄� - </div> - <div v-if="row[item.prop]==='N'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 鍚� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <!-- <el-table-column--> - <!-- prop="RowNum"--> - <!-- width="50"--> - <!-- fixed--> - <!-- label="搴忓彿"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="code"--> - <!-- label="閮ㄤ綅缂栫爜"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="name"--> - <!-- label="閮ㄤ綅鍚嶇О"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="description"--> - <!-- label="淇濆吇瑕佹眰"--> - <!-- sortable="custom"--> - <!-- show-tooltip-when-overflow--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.description">{{ row.description }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="isscan"--> - <!-- label="閫夋嫨鎵爜"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.isscan==='Y'">--> - <!-- <!– <svg-icon icon-class="circleYes" style="margin-right: 2px" />–>--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- 鏄�--> - <!-- </div>--> - <!-- <div v-if="row.isscan==='N'">--> - <!-- <!– <svg-icon icon-class="circleNo" style="margin-right: 2px" />–>--> - <!-- <i class="el-icon-info" style="margin-right: 2px" />--> - <!-- 鍚�--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="lm_user"--> - <!-- label="鍒涘缓浜哄憳"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="lm_date"--> - <!-- label="鍒涘缓鏃堕棿"--> - <!-- width="160"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceMaiItemSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="閮ㄤ綅缂栫爜" prop="maiitemcode"> - <el-input v-model="dialogForm.maiitemcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" prop="maiitemname"> - <el-input v-model="dialogForm.maiitemname" style="width: 200px" /> - </el-form-item> - - <el-form-item required label="閫夋嫨鎵爜"> - <el-select - v-model="dialogForm.isqrcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in isqrcodeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="淇濆吇瑕佹眰" prop="maiitemdescr"> - <el-input v-model="dialogForm.maiitemdescr" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' - -import { AddUpdateDeviceMaiItem, DeleteDeviceMaiItem, DeviceMaiItemSearch } from '@/api/DeviceManager' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'MaintainPosition', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - maiitemcode: '', // 閮ㄤ綅缂栫爜 - maiitemname: '', // 閮ㄤ綅鍚嶇О - maidescr: '', // 淇濆吇瑕佹眰 - isqrcode: '', // 閫変腑鎵爜 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - isqrcodeArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '閮ㄤ綅缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '閮ㄤ綅鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '淇濆吇瑕佹眰', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'isscan', - label: '閫夋嫨鎵爜', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 8, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - dialogForm: { - id: '', - maiitemcode: '', - maiitemname: '', - maiitemdescr: '', - isqrcode: 'N', - OperType: '' - }, - operation: '', - dialogFormRules: { - maiitemcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - maiitemname: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - }, - - title_value: '鏁版嵁瀵煎叆 / 淇濆吇閮ㄤ綅', - code: '11', - shows: false - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDeviceMaiItemSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getDeviceMaiItemSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getDeviceMaiItemSearch() { - const res = await DeviceMaiItemSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceMaiItemSearch() - }, - // 鏌ヨ - search() { - this.getDeviceMaiItemSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.maiitemcode = '' - this.form.maiitemname = '' - this.form.maidescr = '' - this.form.isqrcode = '' - this.getDeviceMaiItemSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.id = row.id - this.dialogForm.maiitemcode = row.code - this.dialogForm.maiitemname = row.name - this.dialogForm.maiitemdescr = row.description - this.dialogForm.isqrcode = row.isscan - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceMaiItem({ maiitemcode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceMaiItemSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.id = '' - this.dialogForm.maiitemcode = '' - this.dialogForm.maiitemname = '' - this.dialogForm.maiitemdescr = '' - this.dialogForm.isqrcode = 'N' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - id: this.dialogForm.id, - maiitemcode: this.dialogForm.maiitemcode, - maiitemname: this.dialogForm.maiitemname, - maiitemdescr: this.dialogForm.maiitemdescr, - isqrcode: this.dialogForm.isqrcode, - OperType: this.operation === 'add' ? 'Add' : 'Update' - } - AddUpdateDeviceMaiItem(data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceMaiItemSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.maiitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.maiitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="淇濆吇瑕佹眰" style=" display: flex;"> + <el-input v-model="form.maidescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閫変腑鎵爜" style=" display: flex;"> + <el-select v-model="form.isqrcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in isqrcodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- <el-table-column--> + <!-- type="selection"--> + <!-- width="50"--> + <!-- />--> + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> + <div v-else-if="item.prop==='isscan'"> + <div v-if="row[item.prop]==='Y'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鏄� + </div> + <div v-if="row[item.prop]==='N'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 鍚� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <!-- <el-table-column--> + <!-- prop="RowNum"--> + <!-- width="50"--> + <!-- fixed--> + <!-- label="搴忓彿"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="code"--> + <!-- label="閮ㄤ綅缂栫爜"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="name"--> + <!-- label="閮ㄤ綅鍚嶇О"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="description"--> + <!-- label="淇濆吇瑕佹眰"--> + <!-- sortable="custom"--> + <!-- show-tooltip-when-overflow--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.description">{{ row.description }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="isscan"--> + <!-- label="閫夋嫨鎵爜"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.isscan==='Y'">--> + <!-- <!– <svg-icon icon-class="circleYes" style="margin-right: 2px" />–>--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- 鏄�--> + <!-- </div>--> + <!-- <div v-if="row.isscan==='N'">--> + <!-- <!– <svg-icon icon-class="circleNo" style="margin-right: 2px" />–>--> + <!-- <i class="el-icon-info" style="margin-right: 2px" />--> + <!-- 鍚�--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="lm_user"--> + <!-- label="鍒涘缓浜哄憳"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="lm_date"--> + <!-- label="鍒涘缓鏃堕棿"--> + <!-- width="160"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceMaiItemSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="閮ㄤ綅缂栫爜" prop="maiitemcode"> + <el-input v-model="dialogForm.maiitemcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" prop="maiitemname"> + <el-input v-model="dialogForm.maiitemname" style="width: 200px" /> + </el-form-item> + + <el-form-item required label="閫夋嫨鎵爜"> + <el-select + v-model="dialogForm.isqrcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in isqrcodeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="淇濆吇瑕佹眰" prop="maiitemdescr"> + <el-input v-model="dialogForm.maiitemdescr" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' + +import { AddUpdateDeviceMaiItem, DeleteDeviceMaiItem, DeviceMaiItemSearch } from '@/api/DeviceManager' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'MaintainPosition', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + maiitemcode: '', // 閮ㄤ綅缂栫爜 + maiitemname: '', // 閮ㄤ綅鍚嶇О + maidescr: '', // 淇濆吇瑕佹眰 + isqrcode: '', // 閫変腑鎵爜 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + isqrcodeArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '閮ㄤ綅缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '閮ㄤ綅鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '淇濆吇瑕佹眰', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'isscan', + label: '閫夋嫨鎵爜', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 8, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + dialogForm: { + id: '', + maiitemcode: '', + maiitemname: '', + maiitemdescr: '', + isqrcode: 'N', + OperType: '' + }, + operation: '', + dialogFormRules: { + maiitemcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + maiitemname: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + }, + + title_value: '鏁版嵁瀵煎叆 / 淇濆吇閮ㄤ綅', + code: '11', + shows: false + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDeviceMaiItemSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getDeviceMaiItemSearch() + }, + created() { + this.getDeviceMaiItemSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getDeviceMaiItemSearch() { + const res = await DeviceMaiItemSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceMaiItemSearch() + }, + // 鏌ヨ + search() { + this.getDeviceMaiItemSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.maiitemcode = '' + this.form.maiitemname = '' + this.form.maidescr = '' + this.form.isqrcode = '' + this.getDeviceMaiItemSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.id = row.id + this.dialogForm.maiitemcode = row.code + this.dialogForm.maiitemname = row.name + this.dialogForm.maiitemdescr = row.description + this.dialogForm.isqrcode = row.isscan + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceMaiItem({ maiitemcode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceMaiItemSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.id = '' + this.dialogForm.maiitemcode = '' + this.dialogForm.maiitemname = '' + this.dialogForm.maiitemdescr = '' + this.dialogForm.isqrcode = 'N' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + id: this.dialogForm.id, + maiitemcode: this.dialogForm.maiitemcode, + maiitemname: this.dialogForm.maiitemname, + maiitemdescr: this.dialogForm.maiitemdescr, + isqrcode: this.dialogForm.isqrcode, + OperType: this.operation === 'add' ? 'Add' : 'Update' + } + AddUpdateDeviceMaiItem(data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceMaiItemSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + diff --git a/src/views/deviceManager/maintainRecord.vue b/src/views/deviceManager/maintainRecord.vue index aa8dd7d..373bee1 100644 --- a/src/views/deviceManager/maintainRecord.vue +++ b/src/views/deviceManager/maintainRecord.vue @@ -1,616 +1,621 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> - <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm" style="justify-content: flex-start"> - <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> - <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in wkshopSelectArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stanedname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="淇濆吇浜哄憳" style=" display: flex;"> - <el-input v-model="form.repairuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="淇濆吇鏃堕棿" style=" display: flex;font-size:14px;align-items: center"> - <el-date-picker - v-model="form.repairdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="淇濆吇缁撴灉" style=" display: flex;"> - <el-select v-model="form.repairresult" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in repairresultArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - - <div v-else-if="item.prop==='maint_cyc'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> - <div v-else-if="item.prop==='maint_result'"> - <div v-if="row[item.prop]==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row[item.prop]==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceRepairTakeSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'淇濆吇鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父</div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父</div> - </template> - </el-table-column> - <el-table-column - prop="maint_value" - label="鏁板��" - /> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible = false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' -import { getCookie } from '@/utils/auth' -import { handleDatetime } from '@/utils/global' -import { DeviceRepairSubTakeSearch, DeviceRepairTakeOutExcel, DeviceRepairTakeSearch -} from '@/api/DeviceManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'MaintainRecord', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', // 杞﹂棿缂栫爜 - eqpcode: '', // 璁惧缂栫爜 - eqpname: '', // 璁惧鍚嶇О - stanedname: '', // 鏍囧噯鍚嶇О - repairuser: '', // 鐐规浜哄憳 - repairdate: '', // 鐐规鏃堕棿 - repairresult: '', // 淇濆吇缁撴灉 - prop: 'maint_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopSelectArr: [], - cycleArr: [ - { code: 'Y', name: '骞�' }, - { code: 'S', name: '瀛�' }, - { code: 'M', name: '鏈�' }, - { code: 'W', name: '鍛�' } - ], - repairresultArr: [ - { code: 'OK', name: '鍚堟牸' }, - { code: 'NG', name: '涓嶈壇' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'bywo', - label: '淇濆吇鍗曞彿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 130, - prop: 'org_code', - label: '鐢熶骇杞﹂棿缂栫爜', - id: 4, - show: false, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'org_name', - label: '鐢熶骇杞﹂棿', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_code', - label: '璁惧缂栫爜', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_name', - label: '璁惧鍚嶇О', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 130, - prop: 'stanedcode', - label: '淇濆吇鏍囧噯缂栫爜', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 130, - width: false, - prop: 'stanedname', - label: '淇濆吇鏍囧噯鍚嶇О', - id: 9, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'maint_cyc', - label: '淇濆吇鍛ㄦ湡', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'maint_user', - label: '淇濆吇浜哄憳', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'maint_result', - label: '淇濆吇缁撴灉', - id: 11, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'maint_date', - label: '淇濆吇鏃堕棿', - id: 12, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - // dialogForm: { - // OrgType: '', - // OrgCode: '', - // OrgName: '', - // SupUnit: ''// 涓婄骇鍗曚綅 - // }, - operation: '', - - tableDataDialog: [], // 鐐规鏄庣粏瀵硅瘽妗唗able - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceRepairTakeSearch().then(res => { - if (res.code === '200') { - this.getShopSearch() - } - }) - }, - async getDeviceRepairTakeSearch() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - wkshopcode: this.form.wkshopcode, - eqpcode: this.form.eqpcode, - eqpname: this.form.eqpname, - stanedname: this.form.stanedname, - repairuser: this.form.repairuser, - repairdate: tempDate, - repairresult: this.form.repairresult, - prop: this.form.prop, // 鎺掑簭瀛楁 - order: this.form.order, // 鎺掑簭瀛楁 - page: this.form.page, // 绗嚑椤� - rows: this.form.rows // 姣忛〉澶氬皯鏉� - } - - const res = await DeviceRepairTakeSearch(data) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 - async getShopSearch() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopSelectArr = res - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceRepairTakeSearch() - }, - // 鏌ヨ - search() { - this.getDeviceRepairTakeSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.eqpcode = '' - this.form.eqpname = '' - this.form.stanedname = '' - this.form.repairuser = '' - this.form.repairdate = '' - this.form.repairresult = '' - this.getDeviceRepairTakeSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await DeviceRepairSubTakeSearch({ bywo: row.bywo }) - - this.tableDataDialog = res.data - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteOrganization({ orgid: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceRepairTakeSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - // this.dialogForm.OrgType = '' - // this.dialogForm.OrgCode = '' - // this.dialogForm.OrgName = '' - // this.dialogForm.SupUnit = '' - // this.$refs.dialogForm.clearValidate() - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - AddUpdateOrganization(data).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getDeviceRepairTakeSearch() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - async download() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, - eqpcode: this.form.eqpcode, - eqpname: this.form.eqpname, - stanedname: this.form.stanedname, - repairuser: this.form.repairuser, - repairdate: tempDate, - repairresult: this.form.repairresult - } - const { data: res } = await DeviceRepairTakeOutExcel(data) - window.location.href = res - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> + <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm" style="justify-content: flex-start"> + <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> + <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in wkshopSelectArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stanedname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="淇濆吇浜哄憳" style=" display: flex;"> + <el-input v-model="form.repairuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="淇濆吇鏃堕棿" style=" display: flex;font-size:14px;align-items: center"> + <el-date-picker + v-model="form.repairdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="淇濆吇缁撴灉" style=" display: flex;"> + <el-select v-model="form.repairresult" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in repairresultArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + + <div v-else-if="item.prop==='maint_cyc'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> + <div v-else-if="item.prop==='maint_result'"> + <div v-if="row[item.prop]==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row[item.prop]==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceRepairTakeSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'淇濆吇鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父</div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父</div> + </template> + </el-table-column> + <el-table-column + prop="maint_value" + label="鏁板��" + /> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible = false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' +import { getCookie } from '@/utils/auth' +import { handleDatetime } from '@/utils/global' +import { DeviceRepairSubTakeSearch, DeviceRepairTakeOutExcel, DeviceRepairTakeSearch +} from '@/api/DeviceManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'MaintainRecord', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', // 杞﹂棿缂栫爜 + eqpcode: '', // 璁惧缂栫爜 + eqpname: '', // 璁惧鍚嶇О + stanedname: '', // 鏍囧噯鍚嶇О + repairuser: '', // 鐐规浜哄憳 + repairdate: '', // 鐐规鏃堕棿 + repairresult: '', // 淇濆吇缁撴灉 + prop: 'maint_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopSelectArr: [], + cycleArr: [ + { code: 'Y', name: '骞�' }, + { code: 'S', name: '瀛�' }, + { code: 'M', name: '鏈�' }, + { code: 'W', name: '鍛�' } + ], + repairresultArr: [ + { code: 'OK', name: '鍚堟牸' }, + { code: 'NG', name: '涓嶈壇' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'bywo', + label: '淇濆吇鍗曞彿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 130, + prop: 'org_code', + label: '鐢熶骇杞﹂棿缂栫爜', + id: 4, + show: false, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'org_name', + label: '鐢熶骇杞﹂棿', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_code', + label: '璁惧缂栫爜', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_name', + label: '璁惧鍚嶇О', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 130, + prop: 'stanedcode', + label: '淇濆吇鏍囧噯缂栫爜', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 130, + width: false, + prop: 'stanedname', + label: '淇濆吇鏍囧噯鍚嶇О', + id: 9, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'maint_cyc', + label: '淇濆吇鍛ㄦ湡', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'maint_user', + label: '淇濆吇浜哄憳', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'maint_result', + label: '淇濆吇缁撴灉', + id: 11, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'maint_date', + label: '淇濆吇鏃堕棿', + id: 12, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + // dialogForm: { + // OrgType: '', + // OrgCode: '', + // OrgName: '', + // SupUnit: ''// 涓婄骇鍗曚綅 + // }, + operation: '', + + tableDataDialog: [], // 鐐规鏄庣粏瀵硅瘽妗唗able + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceRepairTakeSearch().then(res => { + if (res.code === '200') { + this.getShopSearch() + } + }) + }, + async getDeviceRepairTakeSearch() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + wkshopcode: this.form.wkshopcode, + eqpcode: this.form.eqpcode, + eqpname: this.form.eqpname, + stanedname: this.form.stanedname, + repairuser: this.form.repairuser, + repairdate: tempDate, + repairresult: this.form.repairresult, + prop: this.form.prop, // 鎺掑簭瀛楁 + order: this.form.order, // 鎺掑簭瀛楁 + page: this.form.page, // 绗嚑椤� + rows: this.form.rows // 姣忛〉澶氬皯鏉� + } + + const res = await DeviceRepairTakeSearch(data) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 + async getShopSearch() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopSelectArr = res + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceRepairTakeSearch() + }, + // 鏌ヨ + search() { + this.getDeviceRepairTakeSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.eqpcode = '' + this.form.eqpname = '' + this.form.stanedname = '' + this.form.repairuser = '' + this.form.repairdate = '' + this.form.repairresult = '' + this.getDeviceRepairTakeSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await DeviceRepairSubTakeSearch({ bywo: row.bywo }) + + this.tableDataDialog = res.data + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteOrganization({ orgid: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceRepairTakeSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + // this.dialogForm.OrgType = '' + // this.dialogForm.OrgCode = '' + // this.dialogForm.OrgName = '' + // this.dialogForm.SupUnit = '' + // this.$refs.dialogForm.clearValidate() + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + AddUpdateOrganization(data).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getDeviceRepairTakeSearch() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + async download() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, + eqpcode: this.form.eqpcode, + eqpname: this.form.eqpname, + stanedname: this.form.stanedname, + repairuser: this.form.repairuser, + repairdate: tempDate, + repairresult: this.form.repairresult + } + const { data: res } = await DeviceRepairTakeOutExcel(data) + window.location.href = res + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + + } +} +</script> + diff --git a/src/views/deviceManager/maintainStandard.vue b/src/views/deviceManager/maintainStandard.vue index cb429dd..095bd88 100644 --- a/src/views/deviceManager/maintainStandard.vue +++ b/src/views/deviceManager/maintainStandard.vue @@ -1,1298 +1,1303 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11_1')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.repairstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.repairstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> - <el-input v-model="form.repairstanddescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='main_cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> - <div v-else-if="item.prop==='is_repaireqp'"> - <i - v-if="row[item.prop]==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - @click="checkeqpClick(row)" - /> - <i - v-if="row[item.prop]==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185)" - @click="checkeqpClick(row)" - /> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceRepairStandArdSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="8vh" - @closed="handleClose" - > - <!-- @close="handleClose"--> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧淇濆吇鏍囧噯淇℃伅锛� - </div> - <div style="margin: 0 30px;"> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="鏍囧噯缂栫爜" prop="code"> - <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" style="width: 200px" /> - </el-form-item> - <el-form-item required label="淇濆吇鍛ㄦ湡"> - <el-select - v-model="dialogForm.repaircycle" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in cycleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" prop="description"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - </div> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈淇濆吇椤逛俊鎭細 - </div> - <div style="margin-bottom:10px"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> - </div> - <div class="elTableDiv"> - <el-table - ref="tableDataDialogRef" - :data="tableDataDialog" - :height="(tableHeight-300)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-300)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - label="搴忓彿" - /> - <el-table-column - prop="repairitem_code" - show-tooltip-when-overflow - label="淇濆吇閮ㄤ綅缂栫爜" - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.repairitem_code }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.repairitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in repairItemSelectArr" - :key="item.name" - :label="item.code" - :value="item.name" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - prop="repairitem_name" - label="淇濆吇閮ㄤ綅鍚嶇О" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.repairitem_name }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.repairitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in repairItemSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - - <el-table-column - prop="repairitem_descr" - label="淇濆吇瑕佹眰" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.repairitem_descr }}</div> - <el-input v-else v-model="row.repairitem_descr" /> - </template> - </el-table-column> - <el-table-column - prop="isscan" - label="閫夋嫨鎵爜" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.isscan" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> - - <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> - </div> - </template> - </el-table-column> - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- 鍏宠仈璁惧--> - <el-dialog - v-el-drag-dialog - title="鍏宠仈璁惧" - :visible.sync="dialogVisibleEqp" - width="800px" - top="10vh" - :close-on-click-modal="false" - class="dialogVisibleEqp" - @closed="handleCloseEqp" - @close="handleCloseEqp" - > - <!-- @opened="handleOpenedRoles"--> - - <div> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 - </div> - <div class="myCheckboxGroup"> - - <div - v-for="item in dialogFormEqp.eqpArr" - :key="item.code" - :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" - class="myCheckbox" - @click="myCheckboxClick(item)" - > - <!-- <input--> - <!-- class="myCheckboxInput"--> - <!-- type="checkbox"--> - <!-- :value="item.code"--> - <!-- :name="item.name"--> - <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> - <!-- @click="myCheckboxInputClick(item)"--> - <!-- >{{ item.name }}--> - <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> - <!-- onClick="event.cancelBubble = true"--> - <el-checkbox - :key="item.code" - v-model="item.isSelected2" - class="myCheckboxInput" - :value="item.code" - :name="item.name" - :label="item.name" - :checked="item.isSelected2" - @change="myCheckboxInputClick(item)" - /> - <div class="myCheckboxInputLabel">{{ item.name }}</div> - - </div> - </div> - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� - </div> - <el-tree - ref="epqTree" - :data="dialogFormEqp.eqpTree" - show-checkbox - node-key="code" - default-expand-all - style="height: 320px;overflow: auto" - :props="defaultPropsOfEqpTree" - @check="checkBoxClick" - /> - <!-- @check-change="checkChange"--> - - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="eqpDialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateDeviceRepairStandArd, - DeleteDeviceRepairStaned, - DeviceRepairItemSelect, - DeviceRepairStandArdSearch, - DeviceRepairStanedAssociationEqp, - SaveDeviceRepairStanedAssociationEqp, - ViewDeviceRepairStanedSearch -} from '@/api/DeviceManager' -import $ from 'jquery' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'MaintainStandard', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - repairstandcode: '', // 鏍囧噯缂栫爜 - repairstandname: '', // 鏍囧噯鍚嶇О - repairstanddescr: '', // 鐐规绠℃帶 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkcontrArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'Y', name: '骞�' }, - { code: 'S', name: '瀛�' }, - { code: 'M', name: '鏈�' }, - { code: 'W', name: '鍛�' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鏍囧噯鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'main_cycle', - label: '淇濆吇鍛ㄦ湡', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'is_repaireqp', - label: '鍏宠仈璁惧', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - code: '', - name: '', - repaircycle: 'M', - description: '' - }, - operation: '', - dialogFormRules: { - - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } - ], - enable: [ - { required: true, message: '', trigger: ['blur', 'change'] } - ] - }, - tableDataDialog: [], // 琛ㄦ牸鏁版嵁 - - repairItemSelectArr: [], - repairItemIsCancel: true, - dialogVisibleEqp: false, - - dialogFormEqp: { - name: '', - code: '', - eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� - eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� - eqpTree: [], // 璁惧鏍戝舰鎵�鏈� - eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 - }, - defaultPropsOfEqpTree: { - value: 'code', - label: 'name', - children: 'children' - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '23', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDeviceRepairStandArdSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceRepairStandArdSearch().then(res => { - if (res.code === '200') { - this.getDeviceRepairItemSelect() - } - }) - }, - async getDeviceRepairStandArdSearch() { - const res = await DeviceRepairStandArdSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceRepairStandArdSearch() - }, - // 鏌ヨ - search() { - this.getDeviceRepairStandArdSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.repairstandcode = '' - this.form.repairstandname = '' - this.form.repairstanddescr = '' - this.getDeviceRepairStandArdSearch() - }, - - async getDeviceRepairItemSelect() { - const { data: res } = await DeviceRepairItemSelect() - this.repairItemSelectArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.getViewDeviceRepairStanedSearch(row.code) - this.dialogVisible = true - - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - // this.$nextTick(() => { - // this.dialogForm.code = row.code - // this.dialogForm.name = row.name - // this.dialogForm.enable = row.enable - // this.dialogForm.description = row.description - // }) - }, - // 淇敼鍓嶈姹傛帴鍙� - async getViewDeviceRepairStanedSearch(repairstand_code) { - const { data: res } = await ViewDeviceRepairStanedSearch({ repairstand_code }) - this.tableDataDialog = res.Data - - this.dialogForm.code = res.code - this.dialogForm.name = res.name - this.dialogForm.enable = res.enable - this.dialogForm.description = res.description - - this.tableDataDialog.forEach(item => { - item.isVisible = 0 - item.repairitem_code = item.code - item.repairitem_name = item.name - item.repairitem_descr = item.chk_desc - }) - - this.repairItemSelectArr = [...this.repairItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.repairitem_code !== x.code)) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceRepairStaned({ repairstand_code: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceRepairStandArdSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.enable = 'Y' - this.dialogForm.description = '' - this.tableDataDialog = [] - this.getDeviceRepairItemSelect() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - if (this.tableDataDialog.length === 0) { - return this.$message.info('璁惧鍏宠仈淇濆吇椤逛俊鎭笉鑳戒负绌猴紒') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - this.tableDataDialog.filter(item => item.repairitem_code !== '') - - let Data = [] - // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 - Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { - return selfArr.findIndex(item => item.repairitem_code === currentValue.repairitem_code) === currentIndex - }) - Data.forEach((item, index) => { - item.repairitem_seq = index + 1 - }) - - const data = { - 'code': this.dialogForm.code, - 'name': this.dialogForm.name, - 'repaircycle': this.dialogForm.repaircycle, - 'description': this.dialogForm.description, - 'Data': Data - } - - AddUpdateDeviceRepairStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceRepairStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - selectChange(val, row) { - const res = this.repairItemSelectArr.find(item => { - return item.code === val || item.name === val - }) - row.repairitem_descr = res.description - row.repairitem_code = res.code - row.repairitem_name = res.name - }, - // 鏂板琛� - addRow() { - let flag = false - this.tableDataDialog.forEach(item => { - if (item.isVisible === 1) { - // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - } - this.tableDataDialog.push({ - repairitem_code: '', - repairitem_name: '', - repairitem_descr: '', - isscan: 'Y', - isVisible: 1 - }) - - this.repairItemIsCancel = false - }, - editRow(row) { - let flag = false - this.tableDataDialog.forEach((item, index) => { - if (item.isVisible === 1) { - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') - } - - this.repairItemIsCancel = false - this.repairItemSelectArr.splice(0, 0, { - code: row.repairitem_code, - name: row.repairitem_name, - description: row.repairitem_descr - }) - - this.tableDataDialog.forEach((item, index) => { - if (item.repairitem_code === row.repairitem_code) { - this.tableDataDialog.splice(index, 1, { - repairitem_code: row.repairitem_code, - repairitem_name: row.repairitem_name, - repairitem_descr: row.repairitem_descr, - isscan: row.isscan, - isVisible: 1 - }) - } - }) - }, - delRow(row) { - this.repairItemSelectArr.splice(0, 0, { - code: row.repairitem_code, - name: row.repairitem_name, - description: row.repairitem_descr - }) - this.tableDataDialog.forEach((item, index) => { - if (item.repairitem_code === row.repairitem_code) { - this.tableDataDialog.splice(index, 1) - } - }) - }, - saveRow(row) { - if (row.repairitem_code === '' && row.repairitem_name === '') { - return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') - } - row.isVisible = 0 - this.repairItemSelectArr.forEach((item, index) => { - if (item.code === row.repairitem_code) { - this.repairItemSelectArr.splice(index, 1) - } - }) - }, - cancelRow(row) { - if (this.repairItemIsCancel) { - this.repairItemSelectArr.splice(0, 0, { - code: row.repairitem_code, - name: row.repairitem_name, - description: row.repairitem_descr - }) - } - this.JYIsCancel = true - - this.tableDataDialog.forEach((item, index) => { - if (item.repairitem_code === row.repairitem_code && item.isVisible === 1) { - row.isVisible = 0 - this.tableDataDialog.splice(index, 1) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 鍏宠仈璁惧 - checkeqpClick(row) { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - - this.dialogFormEqp.name = row.name - this.dialogFormEqp.code = row.code - - DeviceRepairStanedAssociationEqp({ repairstand_code: row.code }).then(res => { - if (res.code === '200') { - setTimeout(() => { - loading.close() - this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) - - if (this.dialogFormEqp.eqpAll.length > 0) { - this.dialogFormEqp.eqpAll.forEach((item, index) => { - this.dialogFormEqp.eqpArr.push({ - code: item.code, - name: item.name, - type: item.type, - isSelected1: index === 0, - isSelected2: item.flag === 'Y' - }) - if (item.flag === 'Y') { - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (it.flag === 'Y') { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - } - }) - } - }) - this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] - } - - this.dialogVisibleEqp = true - - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, 1000) - } else { - loading.close() - } - }) - }, - // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� - handleCloseEqp() { - this.$refs.epqTree.setCheckedKeys([]) - this.dialogFormEqp.code = '' - this.dialogFormEqp.name = '' - this.dialogFormEqp.eqpAll = [] - this.dialogFormEqp.eqpArr = [] - this.dialogFormEqp.eqpTree = [] - this.dialogFormEqp.eqpCodeSelectedArr = [] - }, - // 澶х洅瀛愮偣鍑� - myCheckboxClick(val) { - this.dialogFormEqp.eqpArr.forEach((item, index) => { - item.isSelected1 = item.code === val.code - if (item.code === val.code) { - this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] - } - }) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, - // 灏忕洅瀛愮偣鍑� - myCheckboxInputClick(val) { - // console.log(val) - val.isSelected2 = !!val.isSelected2 - if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 - console.log('浠庢病閫変腑鍒伴�変腑') - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } else { // 浠庨�変腑鍒版病閫変腑 - console.log('浠庨�変腑鍒版病閫変腑') - const temp = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) - }, - // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 - checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { - let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� - console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === obj.code) { - checkedFatherCode = item.code - } - if (item.children && item.children.length > 0) { - item.children.forEach((it, ind) => { - if (it.code === obj.code) { - checkedFatherCode = item.code - } - }) - } - }) - console.log(checkedFatherCode, 1) - - // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { - console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - console.log(item.code, 777) - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { - if (item === obj.code) { - this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) - } - }) - checkedKeys.forEach(item => { - this.dialogFormEqp.eqpCodeSelectedArr.push(item) - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] - } - - // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 - if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { - console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') - const temp = [] - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = false - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - } - - // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { - console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - } - }, - // 鍙栨秷浜嬩欢 - eqpDialogVisibleCancel() { - this.dialogVisibleEqp = false - }, - // 纭浜嬩欢 - eqpDialogVisibleConfirm() { - // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) - // this.dialogVisibleEqp = false - this.$store.state.app.buttonIsDisabled = true - const data = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { - data.push({ - name: it.name, - code: it.code - }) - } - }) - } - }) - - SaveDeviceRepairStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { - if (res.code === '200') { - this.dialogVisibleEqp = false - this.$notify.success('鍏宠仈鎴愬姛锛�') - this.getDeviceRepairStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } - }) - } - } -} -</script> - -<!--鍏叡椤甸潰鏍峰紡--> -<style lang="scss" scoped> -$main_color: #42b983; - -.dialogVisibleEqp { - .myCheckboxGroup { - display: flex; - flex-wrap: wrap; - - .myCheckbox { - //border: 1px solid $main_color; - border: 1px solid #eee; - display: flex; - min-width: 100px; - padding: 10px; - margin: 10px 30px 0 0; - border-radius: 5px; - cursor: default; - position: relative; - - .myCheckboxInput { - margin: 1px 5px 0 0; - cursor: pointer; - } - - .myCheckboxInputLabel { - position: absolute; - left: 29px; - padding: 5px; - top: 6px; - color: transparent; - } - - } - - //.myCheckbox{ - // border: 1px solid $main_color; - //} - - input[type=checkbox] { - cursor: pointer; - position: relative; - width: 14px; - height: 14px; - font-size: 14px; - } - - input[type=checkbox]::after { - position: absolute; - top: 0; - //color: rgb(130, 35, 35); - color: $main_color; - width: 14px; - height: 14px; - display: inline-block; - visibility: visible; - padding-left: 0px; - text-align: center; - content: ' '; - border-radius: 3px - } - - input[type=checkbox]:checked::after { - //content: "鉁�"; - content: "鈭�"; - color: #fff; - font-size: 12px; - font-weight: bold; - background-color: $main_color; - } - } -} - -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} - -.el-icon-share, .el-icon-delete, .el-icon-edit-outline { - color: $main_color; - cursor: pointer; -} - -.el-icon-edit-outline { - margin-right: 15px; -} - -::v-deep .el-button--primary, .el-button--default, .el-button--info { - height: 34px; - display: flex; - align-items: center; - padding: 0 15px; -} - -::v-deep .el-button--primary { - //background-color: $main_color !important; -} - -::v-deep .el-button--default { - background-color: #f8f8fa; - border: none; -} - -::v-deep .el-input__inner { - height: 34px; - line-height: 34px; - //color: #a7a7a7; -} - -//::v-deep .el-dialog__body { -// padding: 20px 100px !important; -//} -::v-deep .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .dialogVisibleRoles .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .importPickerClass .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .el-dialog__footer { - display: flex; - justify-content: flex-end; -} - -::v-deep .el-table .caret-wrapper { - transform: scale(0.8); -} - -::v-deep .cell { - display: flex; - align-items: center; - justify-content: space-between; -} - -::v-deep .el-table::before { - height: 0; -} - -::v-deep .el-table__body-wrapper { - background-color: #f8f8fa; -} - -::v-deep .el-table__body .el-table__row.hover-row td { - background-color: #eaecef; -} - -::v-deep .el-form--inline .el-form-item__label { - color: #a7a7a7; -} - -.body ::v-deep .el-divider { - border: 1px solid #eee; - width: 99%; - margin: 10px auto; -} - -.body ::v-deep .el-form-item { - margin-bottom: 0; -} - -.userDialogVisible ::v-deep .el-form-item { - margin-bottom: 0; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -.tableFixed { - ::v-deep .el-table__fixed-right { - height: 100% !important; - } - - ::v-deep .el-table__fixed { - height: 100% !important; - } -} - -</style> -<style> -.osloading{ - font-size: 26px !important; -} - -.el-loading-text{ - font-size: 26px !important; -} -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11_1')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.repairstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.repairstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> + <el-input v-model="form.repairstanddescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='main_cycle'">{{ cycleArr.find(i=>i.code===row[item.prop]).name }}</div> + <div v-else-if="item.prop==='is_repaireqp'"> + <i + v-if="row[item.prop]==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + @click="checkeqpClick(row)" + /> + <i + v-if="row[item.prop]==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185)" + @click="checkeqpClick(row)" + /> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceRepairStandArdSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="8vh" + @closed="handleClose" + > + <!-- @close="handleClose"--> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧淇濆吇鏍囧噯淇℃伅锛� + </div> + <div style="margin: 0 30px;"> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="鏍囧噯缂栫爜" prop="code"> + <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" style="width: 200px" /> + </el-form-item> + <el-form-item required label="淇濆吇鍛ㄦ湡"> + <el-select + v-model="dialogForm.repaircycle" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in cycleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" prop="description"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + </div> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈淇濆吇椤逛俊鎭細 + </div> + <div style="margin-bottom:10px"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> + </div> + <div class="elTableDiv"> + <el-table + ref="tableDataDialogRef" + :data="tableDataDialog" + :height="(tableHeight-300)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-300)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + label="搴忓彿" + /> + <el-table-column + prop="repairitem_code" + show-tooltip-when-overflow + label="淇濆吇閮ㄤ綅缂栫爜" + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.repairitem_code }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.repairitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in repairItemSelectArr" + :key="item.name" + :label="item.code" + :value="item.name" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + prop="repairitem_name" + label="淇濆吇閮ㄤ綅鍚嶇О" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.repairitem_name }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.repairitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in repairItemSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + + <el-table-column + prop="repairitem_descr" + label="淇濆吇瑕佹眰" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.repairitem_descr }}</div> + <el-input v-else v-model="row.repairitem_descr" /> + </template> + </el-table-column> + <el-table-column + prop="isscan" + label="閫夋嫨鎵爜" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.isscan" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> + + <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> + </div> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- 鍏宠仈璁惧--> + <el-dialog + v-el-drag-dialog + title="鍏宠仈璁惧" + :visible.sync="dialogVisibleEqp" + width="800px" + top="10vh" + :close-on-click-modal="false" + class="dialogVisibleEqp" + @closed="handleCloseEqp" + @close="handleCloseEqp" + > + <!-- @opened="handleOpenedRoles"--> + + <div> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 + </div> + <div class="myCheckboxGroup"> + + <div + v-for="item in dialogFormEqp.eqpArr" + :key="item.code" + :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" + class="myCheckbox" + @click="myCheckboxClick(item)" + > + <!-- <input--> + <!-- class="myCheckboxInput"--> + <!-- type="checkbox"--> + <!-- :value="item.code"--> + <!-- :name="item.name"--> + <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> + <!-- @click="myCheckboxInputClick(item)"--> + <!-- >{{ item.name }}--> + <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> + <!-- onClick="event.cancelBubble = true"--> + <el-checkbox + :key="item.code" + v-model="item.isSelected2" + class="myCheckboxInput" + :value="item.code" + :name="item.name" + :label="item.name" + :checked="item.isSelected2" + @change="myCheckboxInputClick(item)" + /> + <div class="myCheckboxInputLabel">{{ item.name }}</div> + + </div> + </div> + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� + </div> + <el-tree + ref="epqTree" + :data="dialogFormEqp.eqpTree" + show-checkbox + node-key="code" + default-expand-all + style="height: 320px;overflow: auto" + :props="defaultPropsOfEqpTree" + @check="checkBoxClick" + /> + <!-- @check-change="checkChange"--> + + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="eqpDialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateDeviceRepairStandArd, + DeleteDeviceRepairStaned, + DeviceRepairItemSelect, + DeviceRepairStandArdSearch, + DeviceRepairStanedAssociationEqp, + SaveDeviceRepairStanedAssociationEqp, + ViewDeviceRepairStanedSearch +} from '@/api/DeviceManager' +import $ from 'jquery' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'MaintainStandard', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + repairstandcode: '', // 鏍囧噯缂栫爜 + repairstandname: '', // 鏍囧噯鍚嶇О + repairstanddescr: '', // 鐐规绠℃帶 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkcontrArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'Y', name: '骞�' }, + { code: 'S', name: '瀛�' }, + { code: 'M', name: '鏈�' }, + { code: 'W', name: '鍛�' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鏍囧噯鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'main_cycle', + label: '淇濆吇鍛ㄦ湡', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'is_repaireqp', + label: '鍏宠仈璁惧', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + code: '', + name: '', + repaircycle: 'M', + description: '' + }, + operation: '', + dialogFormRules: { + + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } + ], + enable: [ + { required: true, message: '', trigger: ['blur', 'change'] } + ] + }, + tableDataDialog: [], // 琛ㄦ牸鏁版嵁 + + repairItemSelectArr: [], + repairItemIsCancel: true, + dialogVisibleEqp: false, + + dialogFormEqp: { + name: '', + code: '', + eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� + eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� + eqpTree: [], // 璁惧鏍戝舰鎵�鏈� + eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 + }, + defaultPropsOfEqpTree: { + value: 'code', + label: 'name', + children: 'children' + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '23', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDeviceRepairStandArdSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceRepairStandArdSearch().then(res => { + if (res.code === '200') { + this.getDeviceRepairItemSelect() + } + }) + }, + async getDeviceRepairStandArdSearch() { + const res = await DeviceRepairStandArdSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceRepairStandArdSearch() + }, + // 鏌ヨ + search() { + this.getDeviceRepairStandArdSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.repairstandcode = '' + this.form.repairstandname = '' + this.form.repairstanddescr = '' + this.getDeviceRepairStandArdSearch() + }, + + async getDeviceRepairItemSelect() { + const { data: res } = await DeviceRepairItemSelect() + this.repairItemSelectArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.getViewDeviceRepairStanedSearch(row.code) + this.dialogVisible = true + + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + // this.$nextTick(() => { + // this.dialogForm.code = row.code + // this.dialogForm.name = row.name + // this.dialogForm.enable = row.enable + // this.dialogForm.description = row.description + // }) + }, + // 淇敼鍓嶈姹傛帴鍙� + async getViewDeviceRepairStanedSearch(repairstand_code) { + const { data: res } = await ViewDeviceRepairStanedSearch({ repairstand_code }) + this.tableDataDialog = res.Data + + this.dialogForm.code = res.code + this.dialogForm.name = res.name + this.dialogForm.enable = res.enable + this.dialogForm.description = res.description + + this.tableDataDialog.forEach(item => { + item.isVisible = 0 + item.repairitem_code = item.code + item.repairitem_name = item.name + item.repairitem_descr = item.chk_desc + }) + + this.repairItemSelectArr = [...this.repairItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.repairitem_code !== x.code)) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceRepairStaned({ repairstand_code: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceRepairStandArdSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.enable = 'Y' + this.dialogForm.description = '' + this.tableDataDialog = [] + this.getDeviceRepairItemSelect() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + if (this.tableDataDialog.length === 0) { + return this.$message.info('璁惧鍏宠仈淇濆吇椤逛俊鎭笉鑳戒负绌猴紒') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + this.tableDataDialog.filter(item => item.repairitem_code !== '') + + let Data = [] + // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 + Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { + return selfArr.findIndex(item => item.repairitem_code === currentValue.repairitem_code) === currentIndex + }) + Data.forEach((item, index) => { + item.repairitem_seq = index + 1 + }) + + const data = { + 'code': this.dialogForm.code, + 'name': this.dialogForm.name, + 'repaircycle': this.dialogForm.repaircycle, + 'description': this.dialogForm.description, + 'Data': Data + } + + AddUpdateDeviceRepairStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceRepairStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + selectChange(val, row) { + const res = this.repairItemSelectArr.find(item => { + return item.code === val || item.name === val + }) + row.repairitem_descr = res.description + row.repairitem_code = res.code + row.repairitem_name = res.name + }, + // 鏂板琛� + addRow() { + let flag = false + this.tableDataDialog.forEach(item => { + if (item.isVisible === 1) { + // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + } + this.tableDataDialog.push({ + repairitem_code: '', + repairitem_name: '', + repairitem_descr: '', + isscan: 'Y', + isVisible: 1 + }) + + this.repairItemIsCancel = false + }, + editRow(row) { + let flag = false + this.tableDataDialog.forEach((item, index) => { + if (item.isVisible === 1) { + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') + } + + this.repairItemIsCancel = false + this.repairItemSelectArr.splice(0, 0, { + code: row.repairitem_code, + name: row.repairitem_name, + description: row.repairitem_descr + }) + + this.tableDataDialog.forEach((item, index) => { + if (item.repairitem_code === row.repairitem_code) { + this.tableDataDialog.splice(index, 1, { + repairitem_code: row.repairitem_code, + repairitem_name: row.repairitem_name, + repairitem_descr: row.repairitem_descr, + isscan: row.isscan, + isVisible: 1 + }) + } + }) + }, + delRow(row) { + this.repairItemSelectArr.splice(0, 0, { + code: row.repairitem_code, + name: row.repairitem_name, + description: row.repairitem_descr + }) + this.tableDataDialog.forEach((item, index) => { + if (item.repairitem_code === row.repairitem_code) { + this.tableDataDialog.splice(index, 1) + } + }) + }, + saveRow(row) { + if (row.repairitem_code === '' && row.repairitem_name === '') { + return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') + } + row.isVisible = 0 + this.repairItemSelectArr.forEach((item, index) => { + if (item.code === row.repairitem_code) { + this.repairItemSelectArr.splice(index, 1) + } + }) + }, + cancelRow(row) { + if (this.repairItemIsCancel) { + this.repairItemSelectArr.splice(0, 0, { + code: row.repairitem_code, + name: row.repairitem_name, + description: row.repairitem_descr + }) + } + this.JYIsCancel = true + + this.tableDataDialog.forEach((item, index) => { + if (item.repairitem_code === row.repairitem_code && item.isVisible === 1) { + row.isVisible = 0 + this.tableDataDialog.splice(index, 1) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 鍏宠仈璁惧 + checkeqpClick(row) { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + + this.dialogFormEqp.name = row.name + this.dialogFormEqp.code = row.code + + DeviceRepairStanedAssociationEqp({ repairstand_code: row.code }).then(res => { + if (res.code === '200') { + setTimeout(() => { + loading.close() + this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) + + if (this.dialogFormEqp.eqpAll.length > 0) { + this.dialogFormEqp.eqpAll.forEach((item, index) => { + this.dialogFormEqp.eqpArr.push({ + code: item.code, + name: item.name, + type: item.type, + isSelected1: index === 0, + isSelected2: item.flag === 'Y' + }) + if (item.flag === 'Y') { + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (it.flag === 'Y') { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + } + }) + } + }) + this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] + } + + this.dialogVisibleEqp = true + + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, 1000) + } else { + loading.close() + } + }) + }, + // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� + handleCloseEqp() { + this.$refs.epqTree.setCheckedKeys([]) + this.dialogFormEqp.code = '' + this.dialogFormEqp.name = '' + this.dialogFormEqp.eqpAll = [] + this.dialogFormEqp.eqpArr = [] + this.dialogFormEqp.eqpTree = [] + this.dialogFormEqp.eqpCodeSelectedArr = [] + }, + // 澶х洅瀛愮偣鍑� + myCheckboxClick(val) { + this.dialogFormEqp.eqpArr.forEach((item, index) => { + item.isSelected1 = item.code === val.code + if (item.code === val.code) { + this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] + } + }) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, + // 灏忕洅瀛愮偣鍑� + myCheckboxInputClick(val) { + // console.log(val) + val.isSelected2 = !!val.isSelected2 + if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 + console.log('浠庢病閫変腑鍒伴�変腑') + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } else { // 浠庨�変腑鍒版病閫変腑 + console.log('浠庨�変腑鍒版病閫変腑') + const temp = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) + }, + // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 + checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { + let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� + console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === obj.code) { + checkedFatherCode = item.code + } + if (item.children && item.children.length > 0) { + item.children.forEach((it, ind) => { + if (it.code === obj.code) { + checkedFatherCode = item.code + } + }) + } + }) + console.log(checkedFatherCode, 1) + + // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { + console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + console.log(item.code, 777) + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { + if (item === obj.code) { + this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) + } + }) + checkedKeys.forEach(item => { + this.dialogFormEqp.eqpCodeSelectedArr.push(item) + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] + } + + // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 + if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { + console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') + const temp = [] + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = false + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + } + + // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { + console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + } + }, + // 鍙栨秷浜嬩欢 + eqpDialogVisibleCancel() { + this.dialogVisibleEqp = false + }, + // 纭浜嬩欢 + eqpDialogVisibleConfirm() { + // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) + // this.dialogVisibleEqp = false + this.$store.state.app.buttonIsDisabled = true + const data = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { + data.push({ + name: it.name, + code: it.code + }) + } + }) + } + }) + + SaveDeviceRepairStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { + if (res.code === '200') { + this.dialogVisibleEqp = false + this.$notify.success('鍏宠仈鎴愬姛锛�') + this.getDeviceRepairStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } + }) + } + } +} +</script> + +<!--鍏叡椤甸潰鏍峰紡--> +<style lang="scss" scoped> +$main_color: #42b983; + +.dialogVisibleEqp { + .myCheckboxGroup { + display: flex; + flex-wrap: wrap; + + .myCheckbox { + //border: 1px solid $main_color; + border: 1px solid #eee; + display: flex; + min-width: 100px; + padding: 10px; + margin: 10px 30px 0 0; + border-radius: 5px; + cursor: default; + position: relative; + + .myCheckboxInput { + margin: 1px 5px 0 0; + cursor: pointer; + } + + .myCheckboxInputLabel { + position: absolute; + left: 29px; + padding: 5px; + top: 6px; + color: transparent; + } + + } + + //.myCheckbox{ + // border: 1px solid $main_color; + //} + + input[type=checkbox] { + cursor: pointer; + position: relative; + width: 14px; + height: 14px; + font-size: 14px; + } + + input[type=checkbox]::after { + position: absolute; + top: 0; + //color: rgb(130, 35, 35); + color: $main_color; + width: 14px; + height: 14px; + display: inline-block; + visibility: visible; + padding-left: 0px; + text-align: center; + content: ' '; + border-radius: 3px + } + + input[type=checkbox]:checked::after { + //content: "鉁�"; + content: "鈭�"; + color: #fff; + font-size: 12px; + font-weight: bold; + background-color: $main_color; + } + } +} + +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} + +.el-icon-share, .el-icon-delete, .el-icon-edit-outline { + color: $main_color; + cursor: pointer; +} + +.el-icon-edit-outline { + margin-right: 15px; +} + +::v-deep .el-button--primary, .el-button--default, .el-button--info { + height: 34px; + display: flex; + align-items: center; + padding: 0 15px; +} + +::v-deep .el-button--primary { + //background-color: $main_color !important; +} + +::v-deep .el-button--default { + background-color: #f8f8fa; + border: none; +} + +::v-deep .el-input__inner { + height: 34px; + line-height: 34px; + //color: #a7a7a7; +} + +//::v-deep .el-dialog__body { +// padding: 20px 100px !important; +//} +::v-deep .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .dialogVisibleRoles .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .importPickerClass .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .el-dialog__footer { + display: flex; + justify-content: flex-end; +} + +::v-deep .el-table .caret-wrapper { + transform: scale(0.8); +} + +::v-deep .cell { + display: flex; + align-items: center; + justify-content: space-between; +} + +::v-deep .el-table::before { + height: 0; +} + +::v-deep .el-table__body-wrapper { + background-color: #f8f8fa; +} + +::v-deep .el-table__body .el-table__row.hover-row td { + background-color: #eaecef; +} + +::v-deep .el-form--inline .el-form-item__label { + color: #a7a7a7; +} + +.body ::v-deep .el-divider { + border: 1px solid #eee; + width: 99%; + margin: 10px auto; +} + +.body ::v-deep .el-form-item { + margin-bottom: 0; +} + +.userDialogVisible ::v-deep .el-form-item { + margin-bottom: 0; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +.tableFixed { + ::v-deep .el-table__fixed-right { + height: 100% !important; + } + + ::v-deep .el-table__fixed { + height: 100% !important; + } +} + +</style> +<style> +.osloading{ + font-size: 26px !important; +} + +.el-loading-text{ + font-size: 26px !important; +} +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/deviceManager/repairRecord.vue b/src/views/deviceManager/repairRecord.vue index feead8c..336d275 100644 --- a/src/views/deviceManager/repairRecord.vue +++ b/src/views/deviceManager/repairRecord.vue @@ -1,730 +1,735 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鐢熶骇杞﹂棿"style=" display: flex;"> - <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in wkshopSelectArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鎶ヤ慨浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缁翠慨浜哄憳" style=" display: flex;"> - <el-input v-model="form.repairuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="楠岃瘉浜哄憳" style=" display: flex;"> - <el-input v-model="form.vrifcatuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ヤ慨鏃堕棿" style=" display: flex;align-items: center"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缁翠慨鏃堕棿" style=" display: flex;align-items: center"> - <el-date-picker - v-model="form.repairdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - label="楠岃瘉鏃堕棿" - style=" display: flex;align-items: center" - > - <el-date-picker - v-model="form.vrifcatdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='verify_result'"> - <div v-if="row[item.prop]==='閫氳繃'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 閫氳繃 - </div> - <div v-if="row[item.prop]==='涓嶉�氳繃'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 涓嶉�氳繃 - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceUpdateSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="缁翠慨鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="10vh" - @closed="handleClose" - @close="handleClose" - > - <div style="font-size:16px;"> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎶ヤ慨淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px">鏁呴殰鏉ユ簮锛歿{ dialogData1.faultsource }}</div> - <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData1.faultdescr }}</div> - <div v-if="dialogData1.faultimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� - <div v-for="item in dialogData1.faultimage"> - <img - style="width: 100px;margin-right: 10px" - :src="baseUrl+item.img1url" - alt="" - @click="handlePictureCardPreview(baseUrl+item.img1url,'璁惧鎶ヤ慨/鏁呴殰鍥剧墖')" - > - </div> - </div> - </div> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧缁翠慨淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData2.faultdescr }}</div> - <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� - <div v-for="item in dialogData2.repairimage" v-if="item.img1url!==''"> - <img - style="width: 100px;margin-right: 10px" - :src="baseUrl+item.img1url" - alt="" - @click="handlePictureCardPreview(baseUrl+item.img1url,'璁惧缁翠慨/鏁呴殰鍥剧墖')" - > - </div> - </div> - <div style="margin-bottom: 10px">鍋滄満缁翠慨锛歿{ dialogData2.isstoprepair === 'N' ? '鍚�' : '鏄�' }}</div> - <div v-if="dialogData2.repaircontent" style="margin-bottom: 10px">缁翠慨鍐呭锛歿{ dialogData2.repaircontent }}</div> - <div v-if="dialogData2.repairpart" style="margin-bottom: 10px">鏇存崲澶囦欢锛歿{ dialogData2.repairpart }}</div> - <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">澶囦欢鍥剧墖锛� - <div v-for="item in dialogData2.repairimage" v-if="item.img2url!==''"> - <img - style="width: 100px;margin-right: 10px" - :src="baseUrl+item.img2url" - alt="" - @click="handlePictureCardPreview(baseUrl+item.img2url,'璁惧缁翠慨/澶囦欢鍥剧墖')" - > - </div> - </div> - </div> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧缁翠慨楠岃瘉淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px;display: flex;">楠岃瘉缁撴灉锛� - - <i - v-if="isResult==='閫氳繃'" - class="el-icon-success" - :style="{color:$store.state.settings.theme}" - style="margin-right: 2px" - /> - <i v-if="isResult==='涓嶉�氳繃'" class="el-icon-info" style="margin-right: 2px" /> - - {{ isResult }} - </div> - - </div> - </div> - <!-- 鍥剧墖棰勮瀵硅瘽妗�--> - <el-dialog - title="鍥剧墖棰勮" - :visible.sync="pictureVisible" - width="800px" - append-to-body - @close="pictureHandleClose" - > - <div style="font-size: 16px;margin-bottom: 10px"> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> {{ pictureName }} - </div> - - <img :key="new Date()" width="100%" :src="pictureUrl" alt=""> - - <el-tooltip class="item" effect="light" content="涓婁竴寮�" placement="top"> - <div - v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==0" - style="position: absolute;top: 48%;left: 3.5%;" - ><i - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;font-size: 20px" - class="el-icon-d-arrow-left" - @click="arrowLeftClick(pictureUrl,pictureName)" - /></div> - </el-tooltip> - <el-tooltip class="item" effect="light" content="涓嬩竴寮�" placement="top"> - <div - v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==pictureUrlAll.length-1" - style="position: absolute;top: 48%;right: 3.5%;" - > - <i - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;font-size: 20px" - class="el-icon-d-arrow-right" - @click="arrowRightClick(pictureUrl,pictureName)" - /></div> - </el-tooltip> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="pictureVisible=false">杩� 鍥�</el-button> - </div> - </span> - </el-dialog> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import { DeviceUpdateOutExcel, DeviceUpdateSearch, DeviceUpdateSubSearch } from '@/api/DeviceManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'RepairRecord', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', // 杞﹂棿缂栫爜 - eqpcode: '', // 璁惧缂栫爜 - eqpname: '', // 璁惧鍚嶇О - reportuser: '', // 鎶ヤ慨浜哄憳 - repairuser: '', // 缁翠慨浜哄憳 - vrifcatuser: '', // 楠岃瘉浜哄憳 - reportdate: '', // 鎶ヤ慨鏃堕棿 - repairdate: '', // 缁翠慨鏃堕棿 - vrifcatdate: '', // 楠岃瘉鏃堕棿 - prop: 'repair_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopSelectArr: [], - total: 10, - tableData: [], - - tableColumnSettingsArray: [ - // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'repair_code', - label: '缁翠慨鍗曞彿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 130, - prop: 'wksp_code', - label: '鎵�灞炶溅闂寸紪鐮�', - id: 4, - show: false, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'wksp_name', - label: '鎵�灞炶溅闂�', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'eqp_code', - label: '璁惧缂栫爜', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_name', - label: '璁惧鍚嶇О', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'request_person', - label: '鎶ヤ慨浜�', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 160, - prop: 'request_date', - label: '淇濅慨鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'repair_person', - label: '缁翠慨浜�', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 160, - prop: 'repair_date', - label: '缁翠慨瀹屾垚鏃堕棿', - id: 11, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'cycleDate', - label: '缁翠慨鏃堕暱', - id: 12, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'verify_person', - label: '楠岃瘉浜�', - id: 13, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'verify_date', - label: '楠岃瘉鏃堕棿', - id: 14, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'verify_result', - label: '楠岃瘉缁撴灉', - id: 15, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogData1: {}, - dialogData2: {}, - isResult: '', // 楠岃瘉缁撴灉 - operation: '', - - baseUrl: '', // 鍥剧墖棰勮鍦板潃鍓嶇紑 - - pictureVisible: false, // 鍥剧墖棰勮瀵硅瘽妗� - pictureUrl: '', // 鍥剧墖棰勮Url - pictureName: '', // 鍥剧墖棰勮鍚嶇О - pictureUrlAll: [], // 鍥剧墖棰勮鍦板潃鐨勬墍鏈塙rl - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.baseUrl = process.env.VUE_APP_BASE_API_FILE - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceUpdateSearch().then(res => { - if (res.code === '200') { - this.getShopSearch() - } - }) - }, - async getDeviceUpdateSearch() { - let reportdate = this.form.reportdate - if (reportdate.length > 0) { - reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) - } - let repairdate = this.form.repairdate - if (repairdate.length > 0) { - repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) - } - let vrifcatdate = this.form.vrifcatdate - if (vrifcatdate.length > 0) { - vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 - eqpcode: this.form.eqpcode, // 璁惧缂栫爜 - eqpname: this.form.eqpname, // 璁惧鍚嶇О - reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 - repairuser: this.form.repairuser, // 缁翠慨浜哄憳 - vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 - reportdate, // 鎶ヤ慨鏃堕棿 - repairdate, // 缁翠慨鏃堕棿 - vrifcatdate, // 楠岃瘉鏃堕棿 - prop: 'repair_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - } - - const res = await DeviceUpdateSearch(data) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 - async getShopSearch() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopSelectArr = res - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceUpdateSearch() - }, - // 鏌ヨ - search() { - this.getDeviceUpdateSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.eqpcode = '' - this.form.eqpname = '' - this.form.reportuser = '' - this.form.repairuser = '' - this.form.vrifcatuser = '' - this.form.reportdate = '' - this.form.repairdate = '' - this.form.vrifcatdate = '' - this.getDeviceUpdateSearch() - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const { data: res } = await DeviceUpdateSubSearch({ repair_code: row.repair_code }) - this.dialogData1 = res.data1 - this.dialogData2 = res.data2 - this.isResult = row.verify_result - - // 璁惧鎶ヤ慨鍥剧墖闆嗗悎 - if (this.dialogData1.faultimage) { - this.dialogData1.faultimage.forEach(item => { - this.pictureUrlAll.push( - { url: this.baseUrl + item.img1url, name: '璁惧鎶ヤ慨/鏁呴殰鍥剧墖' } - ) - }) - } - // 璁惧缁翠慨鍥剧墖闆嗗悎 - if (this.dialogData2.repairimage) { - this.dialogData2.repairimage.forEach(item => { - this.pictureUrlAll.push( - { - url: item.img1url ? this.baseUrl + item.img1url : this.baseUrl + item.img2url, - name: item.img1url ? '璁惧缁翠慨/鏁呴殰鍥剧墖' : '璁惧缁翠慨/澶囦欢鍥剧墖' - } - ) - }) - } - }, - handlePictureCardPreview(url, name) { - this.pictureVisible = true - this.pictureUrl = url - this.pictureName = name - }, - arrowLeftClick(pictureUrl, pictureName) { - this.pictureUrlAll.forEach((item, index) => { - if (item.url === pictureUrl) { - this.pictureUrl = this.pictureUrlAll[index - 1].url - this.pictureName = this.pictureUrlAll[index - 1].name - } - }) - }, - arrowRightClick(pictureUrl, pictureName) { - this.pictureUrlAll.forEach((item, index) => { - if (item.url === pictureUrl) { - this.pictureUrl = this.pictureUrlAll[index + 1].url - this.pictureName = this.pictureUrlAll[index + 1].name - } - }) - }, - pictureHandleClose() { - this.pictureUrl = '' - this.pictureName = '' - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogData1 = {} - this.dialogData2 = {} - this.isResult = '' - this.pictureUrlAll = [] - }, - async download() { - let reportdate = this.form.reportdate - if (reportdate.length > 0) { - reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) - } - let repairdate = this.form.repairdate - if (repairdate.length > 0) { - repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) - } - let vrifcatdate = this.form.vrifcatdate - if (vrifcatdate.length > 0) { - vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 - eqpcode: this.form.eqpcode, // 璁惧缂栫爜 - eqpname: this.form.eqpname, // 璁惧鍚嶇О - reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 - repairuser: this.form.repairuser, // 缁翠慨浜哄憳 - vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 - reportdate, // 鎶ヤ慨鏃堕棿 - repairdate, // 缁翠慨鏃堕棿 - vrifcatdate // 楠岃瘉鏃堕棿 - } - const { data: res } = await DeviceUpdateOutExcel(data) - window.location.href = res - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 295 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鐢熶骇杞﹂棿"style=" display: flex;"> + <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in wkshopSelectArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璁惧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.eqpname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鎶ヤ慨浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缁翠慨浜哄憳" style=" display: flex;"> + <el-input v-model="form.repairuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="楠岃瘉浜哄憳" style=" display: flex;"> + <el-input v-model="form.vrifcatuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ヤ慨鏃堕棿" style=" display: flex;align-items: center"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缁翠慨鏃堕棿" style=" display: flex;align-items: center"> + <el-date-picker + v-model="form.repairdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + label="楠岃瘉鏃堕棿" + style=" display: flex;align-items: center" + > + <el-date-picker + v-model="form.vrifcatdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='verify_result'"> + <div v-if="row[item.prop]==='閫氳繃'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 閫氳繃 + </div> + <div v-if="row[item.prop]==='涓嶉�氳繃'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 涓嶉�氳繃 + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceUpdateSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="缁翠慨鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="10vh" + @closed="handleClose" + @close="handleClose" + > + <div style="font-size:16px;"> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎶ヤ慨淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px">鏁呴殰鏉ユ簮锛歿{ dialogData1.faultsource }}</div> + <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData1.faultdescr }}</div> + <div v-if="dialogData1.faultimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� + <div v-for="item in dialogData1.faultimage"> + <img + style="width: 100px;margin-right: 10px" + :src="baseUrl+item.img1url" + alt="" + @click="handlePictureCardPreview(baseUrl+item.img1url,'璁惧鎶ヤ慨/鏁呴殰鍥剧墖')" + > + </div> + </div> + </div> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧缁翠慨淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData2.faultdescr }}</div> + <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� + <div v-for="item in dialogData2.repairimage" v-if="item.img1url!==''"> + <img + style="width: 100px;margin-right: 10px" + :src="baseUrl+item.img1url" + alt="" + @click="handlePictureCardPreview(baseUrl+item.img1url,'璁惧缁翠慨/鏁呴殰鍥剧墖')" + > + </div> + </div> + <div style="margin-bottom: 10px">鍋滄満缁翠慨锛歿{ dialogData2.isstoprepair === 'N' ? '鍚�' : '鏄�' }}</div> + <div v-if="dialogData2.repaircontent" style="margin-bottom: 10px">缁翠慨鍐呭锛歿{ dialogData2.repaircontent }}</div> + <div v-if="dialogData2.repairpart" style="margin-bottom: 10px">鏇存崲澶囦欢锛歿{ dialogData2.repairpart }}</div> + <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">澶囦欢鍥剧墖锛� + <div v-for="item in dialogData2.repairimage" v-if="item.img2url!==''"> + <img + style="width: 100px;margin-right: 10px" + :src="baseUrl+item.img2url" + alt="" + @click="handlePictureCardPreview(baseUrl+item.img2url,'璁惧缁翠慨/澶囦欢鍥剧墖')" + > + </div> + </div> + </div> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧缁翠慨楠岃瘉淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px;display: flex;">楠岃瘉缁撴灉锛� + + <i + v-if="isResult==='閫氳繃'" + class="el-icon-success" + :style="{color:$store.state.settings.theme}" + style="margin-right: 2px" + /> + <i v-if="isResult==='涓嶉�氳繃'" class="el-icon-info" style="margin-right: 2px" /> + + {{ isResult }} + </div> + + </div> + </div> + <!-- 鍥剧墖棰勮瀵硅瘽妗�--> + <el-dialog + title="鍥剧墖棰勮" + :visible.sync="pictureVisible" + width="800px" + append-to-body + @close="pictureHandleClose" + > + <div style="font-size: 16px;margin-bottom: 10px"> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> {{ pictureName }} + </div> + + <img :key="new Date()" width="100%" :src="pictureUrl" alt=""> + + <el-tooltip class="item" effect="light" content="涓婁竴寮�" placement="top"> + <div + v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==0" + style="position: absolute;top: 48%;left: 3.5%;" + ><i + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;font-size: 20px" + class="el-icon-d-arrow-left" + @click="arrowLeftClick(pictureUrl,pictureName)" + /></div> + </el-tooltip> + <el-tooltip class="item" effect="light" content="涓嬩竴寮�" placement="top"> + <div + v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==pictureUrlAll.length-1" + style="position: absolute;top: 48%;right: 3.5%;" + > + <i + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;font-size: 20px" + class="el-icon-d-arrow-right" + @click="arrowRightClick(pictureUrl,pictureName)" + /></div> + </el-tooltip> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="pictureVisible=false">杩� 鍥�</el-button> + </div> + </span> + </el-dialog> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import { DeviceUpdateOutExcel, DeviceUpdateSearch, DeviceUpdateSubSearch } from '@/api/DeviceManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'RepairRecord', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', // 杞﹂棿缂栫爜 + eqpcode: '', // 璁惧缂栫爜 + eqpname: '', // 璁惧鍚嶇О + reportuser: '', // 鎶ヤ慨浜哄憳 + repairuser: '', // 缁翠慨浜哄憳 + vrifcatuser: '', // 楠岃瘉浜哄憳 + reportdate: '', // 鎶ヤ慨鏃堕棿 + repairdate: '', // 缁翠慨鏃堕棿 + vrifcatdate: '', // 楠岃瘉鏃堕棿 + prop: 'repair_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopSelectArr: [], + total: 10, + tableData: [], + + tableColumnSettingsArray: [ + // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'repair_code', + label: '缁翠慨鍗曞彿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 130, + prop: 'wksp_code', + label: '鎵�灞炶溅闂寸紪鐮�', + id: 4, + show: false, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'wksp_name', + label: '鎵�灞炶溅闂�', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'eqp_code', + label: '璁惧缂栫爜', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_name', + label: '璁惧鍚嶇О', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'request_person', + label: '鎶ヤ慨浜�', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 160, + prop: 'request_date', + label: '淇濅慨鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'repair_person', + label: '缁翠慨浜�', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 160, + prop: 'repair_date', + label: '缁翠慨瀹屾垚鏃堕棿', + id: 11, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'cycleDate', + label: '缁翠慨鏃堕暱', + id: 12, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'verify_person', + label: '楠岃瘉浜�', + id: 13, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'verify_date', + label: '楠岃瘉鏃堕棿', + id: 14, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'verify_result', + label: '楠岃瘉缁撴灉', + id: 15, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogData1: {}, + dialogData2: {}, + isResult: '', // 楠岃瘉缁撴灉 + operation: '', + + baseUrl: '', // 鍥剧墖棰勮鍦板潃鍓嶇紑 + + pictureVisible: false, // 鍥剧墖棰勮瀵硅瘽妗� + pictureUrl: '', // 鍥剧墖棰勮Url + pictureName: '', // 鍥剧墖棰勮鍚嶇О + pictureUrlAll: [], // 鍥剧墖棰勮鍦板潃鐨勬墍鏈塙rl + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.baseUrl = process.env.VUE_APP_BASE_API_FILE + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceUpdateSearch().then(res => { + if (res.code === '200') { + this.getShopSearch() + } + }) + }, + async getDeviceUpdateSearch() { + let reportdate = this.form.reportdate + if (reportdate.length > 0) { + reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) + } + let repairdate = this.form.repairdate + if (repairdate.length > 0) { + repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) + } + let vrifcatdate = this.form.vrifcatdate + if (vrifcatdate.length > 0) { + vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 + eqpcode: this.form.eqpcode, // 璁惧缂栫爜 + eqpname: this.form.eqpname, // 璁惧鍚嶇О + reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 + repairuser: this.form.repairuser, // 缁翠慨浜哄憳 + vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 + reportdate, // 鎶ヤ慨鏃堕棿 + repairdate, // 缁翠慨鏃堕棿 + vrifcatdate, // 楠岃瘉鏃堕棿 + prop: 'repair_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + } + + const res = await DeviceUpdateSearch(data) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鑾峰彇鎵ц杞﹂棿涓嬫媺鏁扮粍 + async getShopSearch() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopSelectArr = res + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceUpdateSearch() + }, + // 鏌ヨ + search() { + this.getDeviceUpdateSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.eqpcode = '' + this.form.eqpname = '' + this.form.reportuser = '' + this.form.repairuser = '' + this.form.vrifcatuser = '' + this.form.reportdate = '' + this.form.repairdate = '' + this.form.vrifcatdate = '' + this.getDeviceUpdateSearch() + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const { data: res } = await DeviceUpdateSubSearch({ repair_code: row.repair_code }) + this.dialogData1 = res.data1 + this.dialogData2 = res.data2 + this.isResult = row.verify_result + + // 璁惧鎶ヤ慨鍥剧墖闆嗗悎 + if (this.dialogData1.faultimage) { + this.dialogData1.faultimage.forEach(item => { + this.pictureUrlAll.push( + { url: this.baseUrl + item.img1url, name: '璁惧鎶ヤ慨/鏁呴殰鍥剧墖' } + ) + }) + } + // 璁惧缁翠慨鍥剧墖闆嗗悎 + if (this.dialogData2.repairimage) { + this.dialogData2.repairimage.forEach(item => { + this.pictureUrlAll.push( + { + url: item.img1url ? this.baseUrl + item.img1url : this.baseUrl + item.img2url, + name: item.img1url ? '璁惧缁翠慨/鏁呴殰鍥剧墖' : '璁惧缁翠慨/澶囦欢鍥剧墖' + } + ) + }) + } + }, + handlePictureCardPreview(url, name) { + this.pictureVisible = true + this.pictureUrl = url + this.pictureName = name + }, + arrowLeftClick(pictureUrl, pictureName) { + this.pictureUrlAll.forEach((item, index) => { + if (item.url === pictureUrl) { + this.pictureUrl = this.pictureUrlAll[index - 1].url + this.pictureName = this.pictureUrlAll[index - 1].name + } + }) + }, + arrowRightClick(pictureUrl, pictureName) { + this.pictureUrlAll.forEach((item, index) => { + if (item.url === pictureUrl) { + this.pictureUrl = this.pictureUrlAll[index + 1].url + this.pictureName = this.pictureUrlAll[index + 1].name + } + }) + }, + pictureHandleClose() { + this.pictureUrl = '' + this.pictureName = '' + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogData1 = {} + this.dialogData2 = {} + this.isResult = '' + this.pictureUrlAll = [] + }, + async download() { + let reportdate = this.form.reportdate + if (reportdate.length > 0) { + reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) + } + let repairdate = this.form.repairdate + if (repairdate.length > 0) { + repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) + } + let vrifcatdate = this.form.vrifcatdate + if (vrifcatdate.length > 0) { + vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 + eqpcode: this.form.eqpcode, // 璁惧缂栫爜 + eqpname: this.form.eqpname, // 璁惧鍚嶇О + reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 + repairuser: this.form.repairuser, // 缁翠慨浜哄憳 + vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 + reportdate, // 鎶ヤ慨鏃堕棿 + repairdate, // 缁翠慨鏃堕棿 + vrifcatdate // 楠岃瘉鏃堕棿 + } + const { data: res } = await DeviceUpdateOutExcel(data) + window.location.href = res + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 295 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + diff --git a/src/views/materialManager/inventoryList.vue b/src/views/materialManager/inventoryList.vue index 82be864..cd8aba5 100644 --- a/src/views/materialManager/inventoryList.vue +++ b/src/views/materialManager/inventoryList.vue @@ -1084,6 +1084,8 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getTMaterielClassTree() + this.getSelectApi() }, created() { diff --git a/src/views/materialManager/unitList.vue b/src/views/materialManager/unitList.vue index 301ab2b..2500004 100644 --- a/src/views/materialManager/unitList.vue +++ b/src/views/materialManager/unitList.vue @@ -1,689 +1,694 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div style="display: flex"> - <!-- background:rgba(248,248,250,1);--> - <div style="width: 300px;margin: 10px 10px 0 0;background: #fff"> - - <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> - <div style="display: flex;"> - <div - style="width: 5px;height: 100%;border-radius: 5px;" - :style="{background:$store.state.settings.theme}" - /> - <div style="margin-left: 8px;">璁¢噺鍗曚綅</div> - </div> - - <!-- <div style="margin-right:10px">--> - <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" />--> - <!-- </div>--> - - </div> - - <el-tree - ref="treeLeftRef" - key="treeLeftKey" - style="padding: 10px;overflow: auto;" - :style="{height:(tableHeight+150)+'px'}" - :data="treeLeft" - node-key="code" - highlight-current - :props="defaultPropsLeft" - :default-expand-all="true" - :expand-on-click-node="false" - @node-click="nodeClick" - /> - - </div> - - <div style="width: calc(100% - 300px)"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="getSaveSearchUnit">鍚屾璁¢噺鍗曚綅</el-button> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="code" - label="璁¢噺鍗曚綅缂栫爜" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.isGroup === '0' ? row.code :(!isMainUnitHidden?row.code:'') }} - </template> - </el-table-column> - <el-table-column - prop="name" - label="璁¢噺鍗曚綅鍚嶇О" - sortable="custom" - /> - <el-table-column - v-if="!isMainUnitHidden" - prop="isMainUnit" - label="涓昏閲�" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.isMainUnit === '1' ? '鏄�' : '鍚�' }} - </template> - </el-table-column> - <el-table-column - v-if="!isMainUnitHidden" - prop="changeRate" - label="鎹㈢畻鐜�" - sortable="custom" - /> - - <!-- <el-table-column--> - <!-- prop="data_sources"--> - <!-- label="鏁版嵁鏉ユ簮"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="lm_user" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getTUnitData" - /> - </div> - - </div> - - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form - ref="dialogForm" - inline - :rules="dialogFormRules" - :model="dialogForm" - label-width="120px" - style="display: flex;justify-content: space-between;align-content: flex-end" - > - - <el-form-item :label="dialogForm.tunittype==='S'? '璁¢噺鍗曚綅鍚嶇О':'璁¢噺鍗曚綅缁勫悕绉�'" prop="unitname"> - <el-input v-model="dialogForm.unitname" style="width: 200px" /> - </el-form-item> - - <el-form-item v-if="dialogForm.tunittype==='M'"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="tableDataDialogAdd">鏂板琛� - </el-button> - </el-form-item> - - </el-form> - - <div v-if="dialogForm.tunittype==='M'"> - <el-table - ref="tableDataDialogRef" - class="tableFixed" - :data="tableDataDialog" - row-class-name="custom-row" - height="400" - border - :style="{width: 100+'%',height:'400px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - - <el-table-column - type="index" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="unitname" - label="璁¢噺鍗曚綅鍚嶇О" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.unitname" - placeholder="璇疯緭鍏�" - /> - <div v-else> {{ row.unitname }}</div> - </template> - - </el-table-column> - <el-table-column - - label="涓昏閲�" - prop="checkboxSelected" - > - <template slot-scope="{row}"> - - <el-select - v-if="row.isVisible===1" - v-model="row.checkboxSelected" - :popper-append-to-body="false" - :disabled="row.checkboxSelected==='1'" - placeholder="璇烽�夋嫨" - filterable - @change="val=>checkboxSelectedChange(val,row)" - > - <el-option - v-for="item in checkboxSelectedArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - <div v-else> {{ row.checkboxSelected === '1' ? '鏄�' : '鍚�' }}</div> - </template> - </el-table-column> - - <el-table-column - prop="changeRate" - label="鎹㈢畻鐜�" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.changeRate" - :disabled="row.checkboxSelected==='1'" - placeholder="璇疯緭鍏�" - oninput="value=value.replace(/[^0-9.]/g,'')" - /> - <div v-else> {{ row.changeRate }}</div> - </template> - </el-table-column> - <el-table-column - prop="rateDescription" - label="鎹㈢畻璇存槑" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="row.isVisible===0&&tableDataDialog.filter(i=>i.isVisible===1).length===0" - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="tableDataDialogEdit(row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="row.isVisible===0&&tableDataDialog.filter(i=>i.isVisible===1).length===0" - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="tableDataDialogDel(row)" - /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="淇濆瓨" placement="top"> - <i - v-if="row.isVisible===1" - class="el-icon-circle-check" - style="cursor:pointer;" - :style="{color:$store.state.settings.theme}" - @click="tableDataDialogSave(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - - </el-table> - - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { SaveSearchUnit } from '@/api/ErpSyncMes' -import { AddUpdateTUnit, DeleteTUnit, TUnitData, TUnitGroup, TUnitGroupProject } from '@/api/ProductModel' - -export default { - name: 'UnitList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - // mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - tunittype: '', // 鍗曡閲�(S) 澶氳閲�(M) - tunitgroupcode: '', // 璁¢噺鍗曚綅缁勭紪鐮� - prop: 'isGroup', // 鎺掑簭瀛楁 - order: 'asc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - tunittype: '', // 鍗曡閲�(S) 澶氳閲�(M) - tunitgroupcode: '', // 璁¢噺鍗曚綅缁勭紪鐮� - unitcode: '', - unitname: '', - data_sources: 'MES' - }, - operation: '', - dialogFormRules: { - unitname: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - }, - - defaultPropsLeft: { - children: 'children', - label: 'name' - }, - treeLeft: [], - - tableDataDialog: [], - - checkboxSelectedArr: [ - { code: '0', name: '鍚�' }, - { code: '1', name: '鏄�' } - ], - - isMainUnitHidden: true - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - this.handleGetApi('') - }, - methods: { - async handleGetApi(code) { - await this.getTUnitGroup(code) - await this.getTUnitData() - }, - async getSaveSearchUnit() { - const res = await SaveSearchUnit() - if (res.code === '200') { - await this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) - this.$notify.success('璁¢噺鍗曚綅鍚屾鎴愬姛锛�') - } - }, - async getTUnitGroup(code) { - const { data: res } = await TUnitGroup() - - this.treeLeft = [ - { - code: '', name: '鍏ㄩ儴', children: [ - { code: 'S', name: '鍗曡閲�' }, - { code: 'M', name: '澶氳閲�', children: res } - ] - } - ] - this.$nextTick(() => { - this.$refs.treeLeftRef.setCurrentKey(code) - }) - }, - async getTUnitData() { - const res = await TUnitData(this.form) - - this.tableData = res.data - this.total = res.count - }, - - async getTUnitGroupProject(unitcode) { - const data = { - unitcode, isgroup: '1' - } - const res = await TUnitGroupProject(data) - res.data.forEach((i, index) => { - i.unitname = i.name - i.unitcode = i.code - i.uuid = new Date().getTime() + index - i.isVisible = 0 - // i.idunitgroup = unitcode - i.checkboxSelected = i.isMainUnit === '1' ? '1' : '0' - }) - this.tableDataDialog = res.data - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getTUnitData() - }, - async nodeClick(obj, Node, VueComponent) { - if (obj.code === 'S' || obj.code === 'M' || obj.code === '') { - this.form.tunittype = obj.code - this.form.tunitgroupcode = '' - await this.getTUnitData(obj.code) - this.isMainUnitHidden = true - this.$nextTick(() => { - this.$refs.tableDataRef.doLayout() - }) - } else { - this.form.tunittype = 'M' - this.form.tunitgroupcode = obj.code - await this.getTUnitData(obj.code) - this.isMainUnitHidden = false - this.$nextTick(() => { - this.$refs.tableDataRef.doLayout() - }) - } - }, - add(operation) { - if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M') { - this.dialogForm.tunittype = this.$refs.treeLeftRef.getCurrentKey() - } else { - return this.$message.error('璇峰厛閫夋嫨鏍戜笂鐨勫崟璁¢噺鎴栧璁¢噺锛�') - } - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M' || this.$refs.treeLeftRef.getCurrentKey() === '') { - this.dialogForm.tunittype = row.isGroup === '0' ? 'S' : 'M' - this.dialogForm.tunitgroupcode = row.isGroup === '0' ? row.code : row.idunitgroup - this.dialogForm.unitcode = row.code - this.dialogForm.unitname = row.name - this.dialogForm.data_sources = row.data_sources - } else { - this.dialogForm.tunittype = 'M' - this.dialogForm.tunitgroupcode = row.idunitgroup - this.dialogForm.unitcode = row.idunitgroup - this.dialogForm.unitname = this.treeLeft[0].children[1].children.find(i => i.code === this.$refs.treeLeftRef.getCurrentKey()).name - this.dialogForm.data_sources = row.data_sources - } - - if (this.dialogForm.tunittype === 'M') { - this.getTUnitGroupProject(row.idunitgroup) - } - }) - }, - - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M' || this.$refs.treeLeftRef.getCurrentKey() === '') { - // this.dialogForm.tunittype = this.$refs.treeLeftRef.getCurrentKey() - } else { - if (row.isMainUnit === '1' || this.tableData.length === 2) { - return this.$message.info('璁¢噺鍗曚綅缁勪笅锛屽繀椤绘湁涓�涓富璁¢噺鍜岃嚦灏戜竴涓緟璁¢噺锛�') - } - } - - const data = { - data_sources: row.data_sources, - tunittype: row.isGroup === '0' ? 'S' : 'M', - - tunitgroupcode: row.isGroup === '0' ? '' : row.idunitgroup, - tunitcode: row.isGroup === '0' ? row.code : (this.$refs.treeLeftRef.getCurrentKey() === 'M' ? '' : row.code) - } - DeleteTUnit(data).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - - this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.tunittype = '' - this.dialogForm.tunitgroupcode = '' - this.dialogForm.unitcode = '' - this.dialogForm.unitname = '' - this.dialogForm.data_sources = 'MES' - this.tableDataDialog = [] - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - if (this.tableDataDialog.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨褰撳墠琛岋紒') - } - - let data - if (this.dialogForm.tunittype === 'S') { // 鍗曡閲忔柊澧烇紝淇敼 - data = [{ - unitcode: this.dialogForm.unitcode, - unitname: this.dialogForm.unitname, - children: [ - { - 'unitcode': this.dialogForm.unitcode, - 'unitname': this.dialogForm.unitname, - 'isMainUnit': '0', - 'changeRate': '1', - 'isSingleUnit': '1', - 'disabled': '0', - 'isGroup': '0', - 'rateDescription': '', - 'idunitgroup': '' - } - ] - }] - } - if (this.dialogForm.tunittype === 'M') { // 澶氳閲忔柊澧烇紝淇敼 - if (this.tableDataDialog.length === 0) { - return this.$message.info('璁¢噺鍗曚綅缁勪腑鑷冲皯鍖呭惈涓�涓閲忓崟浣嶏紒') - } - if (this.tableDataDialog.length === 1) { - return this.$message.info('璁¢噺鍗曚綅缁勪笅锛屽繀椤绘湁涓�涓富璁¢噺鍜岃嚦灏戜竴涓緟璁¢噺锛�') - } - - this.tableDataDialog.forEach((i, index) => { - i.unitcode = i.unitcode ? i.unitcode : 'U' + index.toString() - i.isMainUnit = i.checkboxSelected === '1' ? '1' : '0' - i.isSingleUnit = '0' - i.disabled = '0' - i.isGroup = '1' - i.idunitgroup = this.dialogForm.tunitgroupcode - }) - data = [{ - unitcode: this.dialogForm.unitcode, - unitname: this.dialogForm.unitname, - children: this.tableDataDialog - }] - } - console.log(data) - this.$store.state.app.buttonIsDisabled = true - AddUpdateTUnit(data, this.dialogForm.data_sources, this.dialogForm.tunittype, this.dialogForm.tunitgroupcode, this.dialogForm.OperType).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - tableDataDialogAdd() { - if (this.tableDataDialog.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨涓婁竴鏉℃暟鎹紒') - } - - this.tableDataDialog.push({ - unitname: '', - changeRate: 1, - uuid: new Date().getTime(), - checkboxSelected: this.tableDataDialog.length === 0 ? '1' : '0', - isVisible: 1, - data_sources: 'MES' - }) - console.log(this.tableDataDialog) - }, - tableDataDialogEdit(row) { - row.isVisible = 1 - }, - tableDataDialogDel(row) { - if (row.checkboxSelected === '1') { - return this.$message.info('涓昏閲忓崟浣嶄笉鑳藉垹闄わ紒') - } - this.tableDataDialog = this.tableDataDialog.filter(i => i.uuid !== row.uuid) - }, - tableDataDialogSave(row) { - if (!row.unitname) { - return this.$message.info('璁¢噺鍗曚綅鍚嶇О涓嶈兘涓虹┖锛�') - } - if (!row.changeRate) { - return this.$message.info('鎹㈢畻鐜囦笉鑳戒负绌猴紒') - } - if (this.tableDataDialog.filter(i => i.unitname === row.unitname).length > 1) { - return this.$message.info('澶氳閲忕粍鍐呰閲忓崟浣嶅悕绉颁笉鑳介噸澶嶏紒') - } - // console.log(row, 234) - row.isVisible = 0 - if (this.tableDataDialog.length > 1) { - const unitname = this.tableDataDialog.find(i => i.checkboxSelected === '1').unitname - this.tableDataDialog.forEach(i => { - if (i.checkboxSelected === '0') { - i.rateDescription = '1' + i.unitname + '=' + i.changeRate + unitname - } else { - i.rateDescription = '' - } - }) - } - }, - checkboxSelectedChange(val, row) { - row.changeRate = 1 - this.tableDataDialog.forEach(item => { - item.checkboxSelected = item.uuid === row.uuid ? '1' : '0' - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 220 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div style="display: flex"> + <!-- background:rgba(248,248,250,1);--> + <div style="width: 300px;margin: 10px 10px 0 0;background: #fff"> + + <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;"> + <div style="display: flex;"> + <div + style="width: 5px;height: 100%;border-radius: 5px;" + :style="{background:$store.state.settings.theme}" + /> + <div style="margin-left: 8px;">璁¢噺鍗曚綅</div> + </div> + + <!-- <div style="margin-right:10px">--> + <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" />--> + <!-- </div>--> + + </div> + + <el-tree + ref="treeLeftRef" + key="treeLeftKey" + style="padding: 10px;overflow: auto;" + :style="{height:(tableHeight+150)+'px'}" + :data="treeLeft" + node-key="code" + highlight-current + :props="defaultPropsLeft" + :default-expand-all="true" + :expand-on-click-node="false" + @node-click="nodeClick" + /> + + </div> + + <div style="width: calc(100% - 300px)"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="getSaveSearchUnit">鍚屾璁¢噺鍗曚綅</el-button> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="code" + label="璁¢噺鍗曚綅缂栫爜" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.isGroup === '0' ? row.code :(!isMainUnitHidden?row.code:'') }} + </template> + </el-table-column> + <el-table-column + prop="name" + label="璁¢噺鍗曚綅鍚嶇О" + sortable="custom" + /> + <el-table-column + v-if="!isMainUnitHidden" + prop="isMainUnit" + label="涓昏閲�" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.isMainUnit === '1' ? '鏄�' : '鍚�' }} + </template> + </el-table-column> + <el-table-column + v-if="!isMainUnitHidden" + prop="changeRate" + label="鎹㈢畻鐜�" + sortable="custom" + /> + + <!-- <el-table-column--> + <!-- prop="data_sources"--> + <!-- label="鏁版嵁鏉ユ簮"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="lm_user" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getTUnitData" + /> + </div> + + </div> + + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form + ref="dialogForm" + inline + :rules="dialogFormRules" + :model="dialogForm" + label-width="120px" + style="display: flex;justify-content: space-between;align-content: flex-end" + > + + <el-form-item :label="dialogForm.tunittype==='S'? '璁¢噺鍗曚綅鍚嶇О':'璁¢噺鍗曚綅缁勫悕绉�'" prop="unitname"> + <el-input v-model="dialogForm.unitname" style="width: 200px" /> + </el-form-item> + + <el-form-item v-if="dialogForm.tunittype==='M'"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="tableDataDialogAdd">鏂板琛� + </el-button> + </el-form-item> + + </el-form> + + <div v-if="dialogForm.tunittype==='M'"> + <el-table + ref="tableDataDialogRef" + class="tableFixed" + :data="tableDataDialog" + row-class-name="custom-row" + height="400" + border + :style="{width: 100+'%',height:'400px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + + <el-table-column + type="index" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="unitname" + label="璁¢噺鍗曚綅鍚嶇О" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.unitname" + placeholder="璇疯緭鍏�" + /> + <div v-else> {{ row.unitname }}</div> + </template> + + </el-table-column> + <el-table-column + + label="涓昏閲�" + prop="checkboxSelected" + > + <template slot-scope="{row}"> + + <el-select + v-if="row.isVisible===1" + v-model="row.checkboxSelected" + :popper-append-to-body="false" + :disabled="row.checkboxSelected==='1'" + placeholder="璇烽�夋嫨" + filterable + @change="val=>checkboxSelectedChange(val,row)" + > + <el-option + v-for="item in checkboxSelectedArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + <div v-else> {{ row.checkboxSelected === '1' ? '鏄�' : '鍚�' }}</div> + </template> + </el-table-column> + + <el-table-column + prop="changeRate" + label="鎹㈢畻鐜�" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.changeRate" + :disabled="row.checkboxSelected==='1'" + placeholder="璇疯緭鍏�" + oninput="value=value.replace(/[^0-9.]/g,'')" + /> + <div v-else> {{ row.changeRate }}</div> + </template> + </el-table-column> + <el-table-column + prop="rateDescription" + label="鎹㈢畻璇存槑" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="row.isVisible===0&&tableDataDialog.filter(i=>i.isVisible===1).length===0" + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="tableDataDialogEdit(row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="row.isVisible===0&&tableDataDialog.filter(i=>i.isVisible===1).length===0" + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="tableDataDialogDel(row)" + /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="淇濆瓨" placement="top"> + <i + v-if="row.isVisible===1" + class="el-icon-circle-check" + style="cursor:pointer;" + :style="{color:$store.state.settings.theme}" + @click="tableDataDialogSave(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + + </el-table> + + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { SaveSearchUnit } from '@/api/ErpSyncMes' +import { AddUpdateTUnit, DeleteTUnit, TUnitData, TUnitGroup, TUnitGroupProject } from '@/api/ProductModel' + +export default { + name: 'UnitList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + // mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + tunittype: '', // 鍗曡閲�(S) 澶氳閲�(M) + tunitgroupcode: '', // 璁¢噺鍗曚綅缁勭紪鐮� + prop: 'isGroup', // 鎺掑簭瀛楁 + order: 'asc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + tunittype: '', // 鍗曡閲�(S) 澶氳閲�(M) + tunitgroupcode: '', // 璁¢噺鍗曚綅缁勭紪鐮� + unitcode: '', + unitname: '', + data_sources: 'MES' + }, + operation: '', + dialogFormRules: { + unitname: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + }, + + defaultPropsLeft: { + children: 'children', + label: 'name' + }, + treeLeft: [], + + tableDataDialog: [], + + checkboxSelectedArr: [ + { code: '0', name: '鍚�' }, + { code: '1', name: '鏄�' } + ], + + isMainUnitHidden: true + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleGetApi('') + }, + created() { + + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleGetApi('') + }, + methods: { + async handleGetApi(code) { + await this.getTUnitGroup(code) + await this.getTUnitData() + }, + async getSaveSearchUnit() { + const res = await SaveSearchUnit() + if (res.code === '200') { + await this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) + this.$notify.success('璁¢噺鍗曚綅鍚屾鎴愬姛锛�') + } + }, + async getTUnitGroup(code) { + const { data: res } = await TUnitGroup() + + this.treeLeft = [ + { + code: '', name: '鍏ㄩ儴', children: [ + { code: 'S', name: '鍗曡閲�' }, + { code: 'M', name: '澶氳閲�', children: res } + ] + } + ] + this.$nextTick(() => { + this.$refs.treeLeftRef.setCurrentKey(code) + }) + }, + async getTUnitData() { + const res = await TUnitData(this.form) + + this.tableData = res.data + this.total = res.count + }, + + async getTUnitGroupProject(unitcode) { + const data = { + unitcode, isgroup: '1' + } + const res = await TUnitGroupProject(data) + res.data.forEach((i, index) => { + i.unitname = i.name + i.unitcode = i.code + i.uuid = new Date().getTime() + index + i.isVisible = 0 + // i.idunitgroup = unitcode + i.checkboxSelected = i.isMainUnit === '1' ? '1' : '0' + }) + this.tableDataDialog = res.data + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getTUnitData() + }, + async nodeClick(obj, Node, VueComponent) { + if (obj.code === 'S' || obj.code === 'M' || obj.code === '') { + this.form.tunittype = obj.code + this.form.tunitgroupcode = '' + await this.getTUnitData(obj.code) + this.isMainUnitHidden = true + this.$nextTick(() => { + this.$refs.tableDataRef.doLayout() + }) + } else { + this.form.tunittype = 'M' + this.form.tunitgroupcode = obj.code + await this.getTUnitData(obj.code) + this.isMainUnitHidden = false + this.$nextTick(() => { + this.$refs.tableDataRef.doLayout() + }) + } + }, + add(operation) { + if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M') { + this.dialogForm.tunittype = this.$refs.treeLeftRef.getCurrentKey() + } else { + return this.$message.error('璇峰厛閫夋嫨鏍戜笂鐨勫崟璁¢噺鎴栧璁¢噺锛�') + } + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M' || this.$refs.treeLeftRef.getCurrentKey() === '') { + this.dialogForm.tunittype = row.isGroup === '0' ? 'S' : 'M' + this.dialogForm.tunitgroupcode = row.isGroup === '0' ? row.code : row.idunitgroup + this.dialogForm.unitcode = row.code + this.dialogForm.unitname = row.name + this.dialogForm.data_sources = row.data_sources + } else { + this.dialogForm.tunittype = 'M' + this.dialogForm.tunitgroupcode = row.idunitgroup + this.dialogForm.unitcode = row.idunitgroup + this.dialogForm.unitname = this.treeLeft[0].children[1].children.find(i => i.code === this.$refs.treeLeftRef.getCurrentKey()).name + this.dialogForm.data_sources = row.data_sources + } + + if (this.dialogForm.tunittype === 'M') { + this.getTUnitGroupProject(row.idunitgroup) + } + }) + }, + + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + if (this.$refs.treeLeftRef.getCurrentKey() === 'S' || this.$refs.treeLeftRef.getCurrentKey() === 'M' || this.$refs.treeLeftRef.getCurrentKey() === '') { + // this.dialogForm.tunittype = this.$refs.treeLeftRef.getCurrentKey() + } else { + if (row.isMainUnit === '1' || this.tableData.length === 2) { + return this.$message.info('璁¢噺鍗曚綅缁勪笅锛屽繀椤绘湁涓�涓富璁¢噺鍜岃嚦灏戜竴涓緟璁¢噺锛�') + } + } + + const data = { + data_sources: row.data_sources, + tunittype: row.isGroup === '0' ? 'S' : 'M', + + tunitgroupcode: row.isGroup === '0' ? '' : row.idunitgroup, + tunitcode: row.isGroup === '0' ? row.code : (this.$refs.treeLeftRef.getCurrentKey() === 'M' ? '' : row.code) + } + DeleteTUnit(data).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + + this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.tunittype = '' + this.dialogForm.tunitgroupcode = '' + this.dialogForm.unitcode = '' + this.dialogForm.unitname = '' + this.dialogForm.data_sources = 'MES' + this.tableDataDialog = [] + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + if (this.tableDataDialog.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨褰撳墠琛岋紒') + } + + let data + if (this.dialogForm.tunittype === 'S') { // 鍗曡閲忔柊澧烇紝淇敼 + data = [{ + unitcode: this.dialogForm.unitcode, + unitname: this.dialogForm.unitname, + children: [ + { + 'unitcode': this.dialogForm.unitcode, + 'unitname': this.dialogForm.unitname, + 'isMainUnit': '0', + 'changeRate': '1', + 'isSingleUnit': '1', + 'disabled': '0', + 'isGroup': '0', + 'rateDescription': '', + 'idunitgroup': '' + } + ] + }] + } + if (this.dialogForm.tunittype === 'M') { // 澶氳閲忔柊澧烇紝淇敼 + if (this.tableDataDialog.length === 0) { + return this.$message.info('璁¢噺鍗曚綅缁勪腑鑷冲皯鍖呭惈涓�涓閲忓崟浣嶏紒') + } + if (this.tableDataDialog.length === 1) { + return this.$message.info('璁¢噺鍗曚綅缁勪笅锛屽繀椤绘湁涓�涓富璁¢噺鍜岃嚦灏戜竴涓緟璁¢噺锛�') + } + + this.tableDataDialog.forEach((i, index) => { + i.unitcode = i.unitcode ? i.unitcode : 'U' + index.toString() + i.isMainUnit = i.checkboxSelected === '1' ? '1' : '0' + i.isSingleUnit = '0' + i.disabled = '0' + i.isGroup = '1' + i.idunitgroup = this.dialogForm.tunitgroupcode + }) + data = [{ + unitcode: this.dialogForm.unitcode, + unitname: this.dialogForm.unitname, + children: this.tableDataDialog + }] + } + console.log(data) + this.$store.state.app.buttonIsDisabled = true + AddUpdateTUnit(data, this.dialogForm.data_sources, this.dialogForm.tunittype, this.dialogForm.tunitgroupcode, this.dialogForm.OperType).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.handleGetApi(this.$refs.treeLeftRef.getCurrentKey()) + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + tableDataDialogAdd() { + if (this.tableDataDialog.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨涓婁竴鏉℃暟鎹紒') + } + + this.tableDataDialog.push({ + unitname: '', + changeRate: 1, + uuid: new Date().getTime(), + checkboxSelected: this.tableDataDialog.length === 0 ? '1' : '0', + isVisible: 1, + data_sources: 'MES' + }) + console.log(this.tableDataDialog) + }, + tableDataDialogEdit(row) { + row.isVisible = 1 + }, + tableDataDialogDel(row) { + if (row.checkboxSelected === '1') { + return this.$message.info('涓昏閲忓崟浣嶄笉鑳藉垹闄わ紒') + } + this.tableDataDialog = this.tableDataDialog.filter(i => i.uuid !== row.uuid) + }, + tableDataDialogSave(row) { + if (!row.unitname) { + return this.$message.info('璁¢噺鍗曚綅鍚嶇О涓嶈兘涓虹┖锛�') + } + if (!row.changeRate) { + return this.$message.info('鎹㈢畻鐜囦笉鑳戒负绌猴紒') + } + if (this.tableDataDialog.filter(i => i.unitname === row.unitname).length > 1) { + return this.$message.info('澶氳閲忕粍鍐呰閲忓崟浣嶅悕绉颁笉鑳介噸澶嶏紒') + } + // console.log(row, 234) + row.isVisible = 0 + if (this.tableDataDialog.length > 1) { + const unitname = this.tableDataDialog.find(i => i.checkboxSelected === '1').unitname + this.tableDataDialog.forEach(i => { + if (i.checkboxSelected === '0') { + i.rateDescription = '1' + i.unitname + '=' + i.changeRate + unitname + } else { + i.rateDescription = '' + } + }) + } + }, + checkboxSelectedChange(val, row) { + row.changeRate = 1 + this.tableDataDialog.forEach(item => { + item.checkboxSelected = item.uuid === row.uuid ? '1' : '0' + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 220 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/mouldManager/mouldCheck.vue b/src/views/mouldManager/mouldCheck.vue index 09a31c7..04d3161 100644 --- a/src/views/mouldManager/mouldCheck.vue +++ b/src/views/mouldManager/mouldCheck.vue @@ -1,450 +1,455 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=13')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.checkitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.checkitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐐规鎻忚堪" style=" display: flex;"> - <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldCheckItemSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="閮ㄤ綅缂栫爜" prop="checkitemcode"> - <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" prop="checkitemname"> - <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐐规鎻忚堪" prop="checkitemdescr"> - <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import ImportPicker from '@/components/ImportPicker' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { AddUpdateMouldCheckItem, DeleteMouldCheckItem, MouldCheckItemSearch } from '@/api/MouldManager' - -export default { - name: 'MouldCheckPos', - components: { - Pagination, ImportPicker, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - checkitemcode: '', // 閮ㄤ綅缂栫爜 - checkitemname: '', // 閮ㄤ綅鍚嶇О - checkdescr: '', // 鐐规鎻忚堪 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '閮ㄤ綅缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '閮ㄤ綅鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鐐规鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - // { - // minWidth: false, - // width: 110, - // prop: 'isscan', - // label: '閫夋嫨鎵爜', - // id: 6, - // show: true, - // fixed: false, - // sortable: true - // }, - // { - // minWidth: false, - // width: 110, - // prop: 'cycle', - // label: '鐐规鍛ㄦ湡', - // id: 7, - // show: true, - // fixed: false, - // sortable: true - // }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - id: '', - checkitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 - checkitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О - checkitemdescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 - operType: '' // 鎿嶄綔绫诲瀷 - }, - operation: '', - dialogFormRules: { - checkitemcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - checkitemname: [ - { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } - ] - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '10', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldCheckItemSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getMouldCheckItemSearch() { - const res = await MouldCheckItemSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldCheckItemSearch() - }, - // 鏌ヨ - search() { - this.getMouldCheckItemSearch() - }, - // 閲嶇疆 - reset() { - this.form.checkitemcode = '' - this.form.checkitemname = '' - this.form.checkdescr = '' - this.getMouldCheckItemSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.id = row.id - this.dialogForm.checkitemcode = row.code - this.dialogForm.checkitemname = row.name - this.dialogForm.checkitemdescr = row.description - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldCheckItem({ checkitemcode: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getMouldCheckItemSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.id = '' - this.dialogForm.checkitemcode = '' - this.dialogForm.checkitemname = '' - this.dialogForm.checkitemdescr = '' - this.dialogForm.cycle = 'D' - this.dialogForm.isqrcode = 'N' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - id: this.dialogForm.id, - checkitemcode: this.dialogForm.checkitemcode, - checkitemname: this.dialogForm.checkitemname, - checkitemdescr: this.dialogForm.checkitemdescr, - opertype: this.operation === 'add' ? 'Add' : 'Update' - } - AddUpdateMouldCheckItem(data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getMouldCheckItemSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 240 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - } - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=13')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.checkitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.checkitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐐规鎻忚堪" style=" display: flex;"> + <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldCheckItemSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="閮ㄤ綅缂栫爜" prop="checkitemcode"> + <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" prop="checkitemname"> + <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐐规鎻忚堪" prop="checkitemdescr"> + <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import ImportPicker from '@/components/ImportPicker' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { AddUpdateMouldCheckItem, DeleteMouldCheckItem, MouldCheckItemSearch } from '@/api/MouldManager' + +export default { + name: 'MouldCheckPos', + components: { + Pagination, ImportPicker, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + checkitemcode: '', // 閮ㄤ綅缂栫爜 + checkitemname: '', // 閮ㄤ綅鍚嶇О + checkdescr: '', // 鐐规鎻忚堪 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '閮ㄤ綅缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '閮ㄤ綅鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鐐规鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + // { + // minWidth: false, + // width: 110, + // prop: 'isscan', + // label: '閫夋嫨鎵爜', + // id: 6, + // show: true, + // fixed: false, + // sortable: true + // }, + // { + // minWidth: false, + // width: 110, + // prop: 'cycle', + // label: '鐐规鍛ㄦ湡', + // id: 7, + // show: true, + // fixed: false, + // sortable: true + // }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + id: '', + checkitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 + checkitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О + checkitemdescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 + operType: '' // 鎿嶄綔绫诲瀷 + }, + operation: '', + dialogFormRules: { + checkitemcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + checkitemname: [ + { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } + ] + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '10', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldCheckItemSearch() + }, + created() { + this.getMouldCheckItemSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getMouldCheckItemSearch() { + const res = await MouldCheckItemSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldCheckItemSearch() + }, + // 鏌ヨ + search() { + this.getMouldCheckItemSearch() + }, + // 閲嶇疆 + reset() { + this.form.checkitemcode = '' + this.form.checkitemname = '' + this.form.checkdescr = '' + this.getMouldCheckItemSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.id = row.id + this.dialogForm.checkitemcode = row.code + this.dialogForm.checkitemname = row.name + this.dialogForm.checkitemdescr = row.description + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldCheckItem({ checkitemcode: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getMouldCheckItemSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.id = '' + this.dialogForm.checkitemcode = '' + this.dialogForm.checkitemname = '' + this.dialogForm.checkitemdescr = '' + this.dialogForm.cycle = 'D' + this.dialogForm.isqrcode = 'N' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + id: this.dialogForm.id, + checkitemcode: this.dialogForm.checkitemcode, + checkitemname: this.dialogForm.checkitemname, + checkitemdescr: this.dialogForm.checkitemdescr, + opertype: this.operation === 'add' ? 'Add' : 'Update' + } + AddUpdateMouldCheckItem(data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getMouldCheckItemSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 240 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + } + } +} +</script> + diff --git a/src/views/mouldManager/mouldCheckRecord.vue b/src/views/mouldManager/mouldCheckRecord.vue index 6b4b48c..ecf56d0 100644 --- a/src/views/mouldManager/mouldCheckRecord.vue +++ b/src/views/mouldManager/mouldCheckRecord.vue @@ -1,488 +1,493 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item label="鐐规鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.stanedcode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐐规鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stanedname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐐规浜哄憳" style=" display: flex;"> - <el-input v-model="form.checkuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - label="鐐规鏃堕棿" - > - <el-date-picker - v-model="form.checkdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鐐规缁撴灉" style=" display: flex;"> - <el-select v-model="form.checkrequest" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checkrequestArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="djwo" - label="鐐规鍗曞彿" - sortable="custom" - /> - <el-table-column - prop="mould_code" - label="妯″叿缂栫爜" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_name" - label="妯″叿鍚嶇О" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_spec" - label="浜у搧瑙勬牸" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.mould_spec">{{ row.mould_spec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="stanedcode" - label="鐐规鏍囧噯缂栫爜" - sortable="custom" - /> - <el-table-column - prop="stanedname" - label="鐐规鏍囧噯鍚嶇О" - sortable="custom" - /> - - <el-table-column - prop="chk_user" - label="鐐规浜哄憳" - sortable="custom" - /> - <el-table-column - prop="chk_result" - label="鐐规缁撴灉" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.chk_result==='OK'" size="small" type="success">鍚堟牸</el-tag> - <el-tag v-if="row.chk_result==='NG'" size="small" type="danger">寮傚父</el-tag> - </template> - </el-table-column> - - <el-table-column - prop="chk_date" - label="鐐规鏃堕棿" - sortable="custom" - /> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - - <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top"> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldCheckTakeSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - > - <template slot-scope="{row}"> - {{ row.chk_value ? row.chk_value : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { MouldCheckSubTakeSearch, MouldCheckTakeOutExcel, MouldCheckTakeSearch } from '@/api/MouldManager' - -export default { - name: 'MouldCheckRecord', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldcode: '', - mouldname: '', - mouldspec: '', - stanedcode: '', - stanedname: '', - checkuser: '', - checkrequest: '', - checkdate: '', - prop: 'chk_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkrequestArr: [ - { code: 'OK', name: '鍚堟牸' }, - { code: 'NG', name: '寮傚父' } - ], - total: 10, - tableData: [], - dialogVisible: false, - tableDataDialog: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldCheckTakeSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getMouldCheckTakeSearch() { - let tempDate = this.form.checkdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - stanedcode: this.form.stanedcode, - stanedname: this.form.stanedname, - checkuser: this.form.checkuser, - checkrequest: this.form.checkrequest, - checkdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - console.log(data, 1) - const res = await MouldCheckTakeSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldCheckTakeSearch() - }, - async download() { - let tempDate = this.form.checkdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - stanedcode: this.form.stanedcode, - stanedname: this.form.stanedname, - checkuser: this.form.checkuser, - checkrequest: this.form.checkrequest, - checkdate: tempDate - } - - const { data: res } = await MouldCheckTakeOutExcel(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMouldCheckTakeSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.mouldspec = '' - this.form.stanedcode = '' - this.form.stanedname = '' - this.form.checkuser = '' - this.form.checkrequest = '' - this.form.checkdate = '' - this.getMouldCheckTakeSearch() - }, - - // 淇敼鎸夐挳 - async edit(row) { - this.dialogVisible = true - - const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) - this.tableDataDialog = res - - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item label="鐐规鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.stanedcode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐐规鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stanedname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐐规浜哄憳" style=" display: flex;"> + <el-input v-model="form.checkuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + label="鐐规鏃堕棿" + > + <el-date-picker + v-model="form.checkdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鐐规缁撴灉" style=" display: flex;"> + <el-select v-model="form.checkrequest" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checkrequestArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="djwo" + label="鐐规鍗曞彿" + sortable="custom" + /> + <el-table-column + prop="mould_code" + label="妯″叿缂栫爜" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_name" + label="妯″叿鍚嶇О" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_spec" + label="浜у搧瑙勬牸" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.mould_spec">{{ row.mould_spec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="stanedcode" + label="鐐规鏍囧噯缂栫爜" + sortable="custom" + /> + <el-table-column + prop="stanedname" + label="鐐规鏍囧噯鍚嶇О" + sortable="custom" + /> + + <el-table-column + prop="chk_user" + label="鐐规浜哄憳" + sortable="custom" + /> + <el-table-column + prop="chk_result" + label="鐐规缁撴灉" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.chk_result==='OK'" size="small" type="success">鍚堟牸</el-tag> + <el-tag v-if="row.chk_result==='NG'" size="small" type="danger">寮傚父</el-tag> + </template> + </el-table-column> + + <el-table-column + prop="chk_date" + label="鐐规鏃堕棿" + sortable="custom" + /> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + + <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top"> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldCheckTakeSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + > + <template slot-scope="{row}"> + {{ row.chk_value ? row.chk_value : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { MouldCheckSubTakeSearch, MouldCheckTakeOutExcel, MouldCheckTakeSearch } from '@/api/MouldManager' + +export default { + name: 'MouldCheckRecord', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldcode: '', + mouldname: '', + mouldspec: '', + stanedcode: '', + stanedname: '', + checkuser: '', + checkrequest: '', + checkdate: '', + prop: 'chk_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkrequestArr: [ + { code: 'OK', name: '鍚堟牸' }, + { code: 'NG', name: '寮傚父' } + ], + total: 10, + tableData: [], + dialogVisible: false, + tableDataDialog: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldCheckTakeSearch() + }, + created() { + this.getMouldCheckTakeSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getMouldCheckTakeSearch() { + let tempDate = this.form.checkdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + stanedcode: this.form.stanedcode, + stanedname: this.form.stanedname, + checkuser: this.form.checkuser, + checkrequest: this.form.checkrequest, + checkdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + console.log(data, 1) + const res = await MouldCheckTakeSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldCheckTakeSearch() + }, + async download() { + let tempDate = this.form.checkdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + stanedcode: this.form.stanedcode, + stanedname: this.form.stanedname, + checkuser: this.form.checkuser, + checkrequest: this.form.checkrequest, + checkdate: tempDate + } + + const { data: res } = await MouldCheckTakeOutExcel(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMouldCheckTakeSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.mouldspec = '' + this.form.stanedcode = '' + this.form.stanedname = '' + this.form.checkuser = '' + this.form.checkrequest = '' + this.form.checkdate = '' + this.getMouldCheckTakeSearch() + }, + + // 淇敼鎸夐挳 + async edit(row) { + this.dialogVisible = true + + const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) + this.tableDataDialog = res + + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/mouldManager/mouldCheckStand.vue b/src/views/mouldManager/mouldCheckStand.vue index cfabe9d..9dd6c62 100644 --- a/src/views/mouldManager/mouldCheckStand.vue +++ b/src/views/mouldManager/mouldCheckStand.vue @@ -1,713 +1,718 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=13_1')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> - <el-input v-model="form.checkstandescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - style="height:5px" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='is_checkmould'"> - <i - v-if="row[item.prop]==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - style="cursor: pointer" - @click="connectClick(row)" - /> - <i - v-if="row[item.prop]==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185);cursor:pointer;" - @click="connectClick(row)" - /> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - :style="{color:$store.state.settings.theme}" - class="el-icon-edit-outline" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceCheckStandArdSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="1100px" - :close-on-click-modal="false" - top="8vh" - @closed="handleClose" - @close="handleClose" - > - <div style="margin: 0 30px;"> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-divider content-position="left">妯″叿鐐规鏍囧噯淇℃伅</el-divider> - - <el-form-item label="鏍囧噯缂栫爜" prop="code"> - <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" prop="description"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - </div> - <el-divider content-position="left">鎸囧畾鐐规椤逛俊鎭�</el-divider> - <div style="display: flex;align-items: center"> - <!-- <div style="font-weight: bolder">鐐规椤归�夋嫨锛�</div>--> - <el-drag-select - v-model="checkSelectedValue" - style="width:940px;" - multiple - placeholder="璇烽�夋嫨鐩稿搴旀寚瀹氶」" - > - <el-option - v-for="item in checkSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-drag-select> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataDialogRef" - :data="tableDataDialog" - :height="(tableHeight-300)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-300)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - label="搴忓彿" - /> - <el-table-column - prop="code" - width="150" - label="鐐规閮ㄤ綅缂栫爜" - show-tooltip-when-overflow - /> - <el-table-column - prop="name" - label="鐐规閮ㄤ綅鍚嶇О" - width="150" - show-tooltip-when-overflow - /> - - <el-table-column - prop="description" - label="鐐规瑕佹眰" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <el-input v-model="row.description" /> - </template> - </el-table-column> - - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="鍏宠仈妯″叿" - :visible.sync="mouldDialogVisible" - width="800px" - :close-on-click-modal="false" - top="8vh" - @closed="handleMouldClose" - @close="handleMouldClose" - > - <div> - <el-input - v-model="filterText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - /> - <el-tree - ref="tree" - class="filter-tree" - :data="tree" - :props="defaultProps" - show-checkbox - node-key="code" - style="margin-top:15px;height: 550px;overflow: auto" - default-expand-all - :filter-node-method="filterNode" - /> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="mouldDialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="mouldDialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { - AddUpdateMouldCheckStandArd, CheckStanedAssociationMould, - DeleteMouldCheckStaned, - DeviceCheckStandArdSearch, SaveCheckStanedAssociationMould, - ViewMouldCheckStanedSearch -} from '@/api/MouldManager' -import ElDragSelect from '@/components/DragSelect' -import { MouldCheckItemSelect } from '@/api/GeneralBasicData' -import arrayToTree from 'array-to-tree' - -export default { - name: 'MouldCheckStand', - components: { - Pagination, TableColumnSettings, ElDragSelect - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - checkstandcode: '', // 鏍囧噯缂栫爜 - checkstandname: '', // 鏍囧噯鍚嶇О - checkstandescr: '', // 鐐规绠℃帶 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkcontrArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'D', name: '鏃�' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鏍囧噯鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'is_checkmould', - label: '鍏宠仈妯″叿', - id: 6, - show: true, - fixed: false, - sortable: true - }, - // { - // minWidth: false, - // width: 110, - // prop: 'is_checkeqp', - // label: '鍏宠仈璁惧', - // id: 7, - // show: true, - // fixed: false, - // sortable: true - // }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - code: '', - name: '', - description: '' - }, - operation: '', - dialogFormRules: { - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } - ] - - }, - tableDataDialog: [], // 琛ㄦ牸鏁版嵁 - - checkSelectedValue: [], - checkSelectArr: [], - - mouldDialogVisible: false, - tree: [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ], - filterText: '', - defaultProps: { - children: 'children', - label: 'name' - }, - checkstand_code: '' - - } - }, - watch: { - filterText(val) { - this.$refs.tree.filter(val) - }, - 'checkSelectedValue': { - handler: function(val) { - const arr = JSON.parse(JSON.stringify(this.tableDataDialog)) - const arrCheckcode = arr.map(i => i.code) - this.tableDataDialog = [] - val.forEach(i => { - this.tableDataDialog.push( - { - code: i, - name: this.checkSelectArr.find(j => j.code === i).name, - description: arrCheckcode.includes(i) ? arr.find(j => j.code === i).description : this.checkSelectArr.find(j => j.code === i).description - } - ) - }) - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceCheckStandArdSearch().then(res => { - if (res.code === '200') { - this.getMouldCheckItemSelect() - } - }) - }, - async getDeviceCheckStandArdSearch() { - const res = await DeviceCheckStandArdSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceCheckStandArdSearch() - }, - // 鏌ヨ - search() { - this.getDeviceCheckStandArdSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.checkstandcode = '' - this.form.checkstandname = '' - this.form.checkstandescr = '' - this.getDeviceCheckStandArdSearch() - }, - - async getMouldCheckItemSelect() { - const { data: res } = await MouldCheckItemSelect() - this.checkSelectArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.getViewDeviceCheckStanedSearch(row.code) - this.dialogVisible = true - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鍓嶈姹傛帴鍙� - async getViewDeviceCheckStanedSearch(checkstand_code) { - const { data: res } = await ViewMouldCheckStanedSearch({ checkstand_code }) - this.tableDataDialog = res.data - this.checkSelectedValue = res.data.map(i => i.code) - - this.dialogForm.code = res.code - this.dialogForm.name = res.name - this.dialogForm.description = res.description - - this.tableDataDialog.forEach(item => { - item.description = item.chkdesc - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldCheckStaned({ checkstand_code: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceCheckStandArdSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.description = '' - this.tableDataDialog = [] - this.checkSelectedValue = [] - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - if (this.tableDataDialog.length === 0) { - return this.$message.info('鐐规椤逛俊鎭笉鑳戒负绌猴紒') - } - - const Data = [] - this.tableDataDialog.forEach((i, index) => { - Data.push({ - checkitem_seq: index + 1, - checkitem_code: i.code, - checkitem_name: i.name, - checkitem_descr: i.description, - cycle: '', - isscan: '' - }) - }) - const data = { - 'code': this.dialogForm.code, - 'name': this.dialogForm.name, - 'description': this.dialogForm.description, - 'Data': Data - } - - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceCheckStandArdSearch() - // this.getMouldCheckItemSelect() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - // 鍏宠仈妯″叿鐐瑰嚮 - async connectClick(row) { - const { data: res } = await CheckStanedAssociationMould({ checkstand_code: row.code }) - this.checkstand_code = row.code - - const keySelected = [] - res.forEach(i => { - i.parentid = '-1' - i.name = i.code + ' / ' + i.name - - if (i.flag === 'Y') { - keySelected.push(i.code) - } - }) - this.tree = arrayToTree(this.tree.concat(res), { - parentProperty: 'parentid', - customID: 'code', - childrenProperty: 'children' - }) - this.mouldDialogVisible = true - this.$nextTick(() => { - this.$refs.tree.setCheckedKeys(keySelected) - }) - }, - filterNode(value, data) { - if (!value) return true - return data.name.indexOf(value) !== -1 - }, - handleMouldClose() { - this.tree = [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ] - }, - mouldDialogVisibleCancel() { - this.mouldDialogVisible = false - }, - mouldDialogVisibleConfirm() { - const treeKey = this.$refs.tree.getCheckedKeys() - const arr = [] - this.tree[0].children.forEach(i => { - // i.flag = treeKey.includes(i.code) ? 'Y' : 'N' - if (treeKey.includes(i.code)) { - arr.push({ - code: i.code, - name: i.name.split('/')[1].trim() - }) - } - }) - - this.$store.state.app.buttonIsDisabled = true - SaveCheckStanedAssociationMould(arr, this.checkstand_code).then(res => { - if (res.code === '200') { - this.$notify.success('缁戝畾鎴愬姛锛�') - this.mouldDialogVisible = false - this.getDeviceCheckStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error('缁戝畾澶辫触锛�') - } - }) - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 205 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - - } -} -</script> -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=13_1')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> + <el-input v-model="form.checkstandescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + style="height:5px" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='is_checkmould'"> + <i + v-if="row[item.prop]==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + style="cursor: pointer" + @click="connectClick(row)" + /> + <i + v-if="row[item.prop]==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185);cursor:pointer;" + @click="connectClick(row)" + /> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + :style="{color:$store.state.settings.theme}" + class="el-icon-edit-outline" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceCheckStandArdSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="1100px" + :close-on-click-modal="false" + top="8vh" + @closed="handleClose" + @close="handleClose" + > + <div style="margin: 0 30px;"> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-divider content-position="left">妯″叿鐐规鏍囧噯淇℃伅</el-divider> + + <el-form-item label="鏍囧噯缂栫爜" prop="code"> + <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" prop="description"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + </div> + <el-divider content-position="left">鎸囧畾鐐规椤逛俊鎭�</el-divider> + <div style="display: flex;align-items: center"> + <!-- <div style="font-weight: bolder">鐐规椤归�夋嫨锛�</div>--> + <el-drag-select + v-model="checkSelectedValue" + style="width:940px;" + multiple + placeholder="璇烽�夋嫨鐩稿搴旀寚瀹氶」" + > + <el-option + v-for="item in checkSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-drag-select> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataDialogRef" + :data="tableDataDialog" + :height="(tableHeight-300)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-300)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + label="搴忓彿" + /> + <el-table-column + prop="code" + width="150" + label="鐐规閮ㄤ綅缂栫爜" + show-tooltip-when-overflow + /> + <el-table-column + prop="name" + label="鐐规閮ㄤ綅鍚嶇О" + width="150" + show-tooltip-when-overflow + /> + + <el-table-column + prop="description" + label="鐐规瑕佹眰" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <el-input v-model="row.description" /> + </template> + </el-table-column> + + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="鍏宠仈妯″叿" + :visible.sync="mouldDialogVisible" + width="800px" + :close-on-click-modal="false" + top="8vh" + @closed="handleMouldClose" + @close="handleMouldClose" + > + <div> + <el-input + v-model="filterText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + /> + <el-tree + ref="tree" + class="filter-tree" + :data="tree" + :props="defaultProps" + show-checkbox + node-key="code" + style="margin-top:15px;height: 550px;overflow: auto" + default-expand-all + :filter-node-method="filterNode" + /> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="mouldDialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="mouldDialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { + AddUpdateMouldCheckStandArd, CheckStanedAssociationMould, + DeleteMouldCheckStaned, + DeviceCheckStandArdSearch, SaveCheckStanedAssociationMould, + ViewMouldCheckStanedSearch +} from '@/api/MouldManager' +import ElDragSelect from '@/components/DragSelect' +import { MouldCheckItemSelect } from '@/api/GeneralBasicData' +import arrayToTree from 'array-to-tree' + +export default { + name: 'MouldCheckStand', + components: { + Pagination, TableColumnSettings, ElDragSelect + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + checkstandcode: '', // 鏍囧噯缂栫爜 + checkstandname: '', // 鏍囧噯鍚嶇О + checkstandescr: '', // 鐐规绠℃帶 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkcontrArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'D', name: '鏃�' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鏍囧噯鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'is_checkmould', + label: '鍏宠仈妯″叿', + id: 6, + show: true, + fixed: false, + sortable: true + }, + // { + // minWidth: false, + // width: 110, + // prop: 'is_checkeqp', + // label: '鍏宠仈璁惧', + // id: 7, + // show: true, + // fixed: false, + // sortable: true + // }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + code: '', + name: '', + description: '' + }, + operation: '', + dialogFormRules: { + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } + ] + + }, + tableDataDialog: [], // 琛ㄦ牸鏁版嵁 + + checkSelectedValue: [], + checkSelectArr: [], + + mouldDialogVisible: false, + tree: [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ], + filterText: '', + defaultProps: { + children: 'children', + label: 'name' + }, + checkstand_code: '' + + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + }, + 'checkSelectedValue': { + handler: function(val) { + const arr = JSON.parse(JSON.stringify(this.tableDataDialog)) + const arrCheckcode = arr.map(i => i.code) + this.tableDataDialog = [] + val.forEach(i => { + this.tableDataDialog.push( + { + code: i, + name: this.checkSelectArr.find(j => j.code === i).name, + description: arrCheckcode.includes(i) ? arr.find(j => j.code === i).description : this.checkSelectArr.find(j => j.code === i).description + } + ) + }) + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceCheckStandArdSearch().then(res => { + if (res.code === '200') { + this.getMouldCheckItemSelect() + } + }) + }, + async getDeviceCheckStandArdSearch() { + const res = await DeviceCheckStandArdSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceCheckStandArdSearch() + }, + // 鏌ヨ + search() { + this.getDeviceCheckStandArdSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.checkstandcode = '' + this.form.checkstandname = '' + this.form.checkstandescr = '' + this.getDeviceCheckStandArdSearch() + }, + + async getMouldCheckItemSelect() { + const { data: res } = await MouldCheckItemSelect() + this.checkSelectArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.getViewDeviceCheckStanedSearch(row.code) + this.dialogVisible = true + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鍓嶈姹傛帴鍙� + async getViewDeviceCheckStanedSearch(checkstand_code) { + const { data: res } = await ViewMouldCheckStanedSearch({ checkstand_code }) + this.tableDataDialog = res.data + this.checkSelectedValue = res.data.map(i => i.code) + + this.dialogForm.code = res.code + this.dialogForm.name = res.name + this.dialogForm.description = res.description + + this.tableDataDialog.forEach(item => { + item.description = item.chkdesc + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldCheckStaned({ checkstand_code: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceCheckStandArdSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.description = '' + this.tableDataDialog = [] + this.checkSelectedValue = [] + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + if (this.tableDataDialog.length === 0) { + return this.$message.info('鐐规椤逛俊鎭笉鑳戒负绌猴紒') + } + + const Data = [] + this.tableDataDialog.forEach((i, index) => { + Data.push({ + checkitem_seq: index + 1, + checkitem_code: i.code, + checkitem_name: i.name, + checkitem_descr: i.description, + cycle: '', + isscan: '' + }) + }) + const data = { + 'code': this.dialogForm.code, + 'name': this.dialogForm.name, + 'description': this.dialogForm.description, + 'Data': Data + } + + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceCheckStandArdSearch() + // this.getMouldCheckItemSelect() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + // 鍏宠仈妯″叿鐐瑰嚮 + async connectClick(row) { + const { data: res } = await CheckStanedAssociationMould({ checkstand_code: row.code }) + this.checkstand_code = row.code + + const keySelected = [] + res.forEach(i => { + i.parentid = '-1' + i.name = i.code + ' / ' + i.name + + if (i.flag === 'Y') { + keySelected.push(i.code) + } + }) + this.tree = arrayToTree(this.tree.concat(res), { + parentProperty: 'parentid', + customID: 'code', + childrenProperty: 'children' + }) + this.mouldDialogVisible = true + this.$nextTick(() => { + this.$refs.tree.setCheckedKeys(keySelected) + }) + }, + filterNode(value, data) { + if (!value) return true + return data.name.indexOf(value) !== -1 + }, + handleMouldClose() { + this.tree = [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ] + }, + mouldDialogVisibleCancel() { + this.mouldDialogVisible = false + }, + mouldDialogVisibleConfirm() { + const treeKey = this.$refs.tree.getCheckedKeys() + const arr = [] + this.tree[0].children.forEach(i => { + // i.flag = treeKey.includes(i.code) ? 'Y' : 'N' + if (treeKey.includes(i.code)) { + arr.push({ + code: i.code, + name: i.name.split('/')[1].trim() + }) + } + }) + + this.$store.state.app.buttonIsDisabled = true + SaveCheckStanedAssociationMould(arr, this.checkstand_code).then(res => { + if (res.code === '200') { + this.$notify.success('缁戝畾鎴愬姛锛�') + this.mouldDialogVisible = false + this.getDeviceCheckStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error('缁戝畾澶辫触锛�') + } + }) + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 205 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + + } +} +</script> +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} +</style> diff --git a/src/views/mouldManager/mouldCirculateRecord.vue b/src/views/mouldManager/mouldCirculateRecord.vue index 0218604..b649729 100644 --- a/src/views/mouldManager/mouldCirculateRecord.vue +++ b/src/views/mouldManager/mouldCirculateRecord.vue @@ -1,476 +1,481 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - - <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> - <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in typeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> - <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - label="鎿嶄綔鏃堕棿" - > - <el-date-picker - v-model="form.operdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - - <el-table-column - prop="mould_code" - label="妯″叿缂栫爜" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_name" - label="妯″叿鍚嶇О" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_spec" - label="浜у搧瑙勬牸" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.mould_spec">{{ row.mould_spec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="type" - label="鎿嶄綔绫诲瀷" - sortable="custom" - /> - <el-table-column - prop="description" - label="鍊熻繕鎻忚堪" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description?row.description:'/' }} - </template> - </el-table-column> - - <el-table-column - prop="lm_user" - label="鎿嶄綔浜�" - sortable="custom" - /> - - <el-table-column - prop="lm_date" - label="鎿嶄綔鏃堕棿" - sortable="custom" - /> - - <!-- <el-table-column--> - <!-- label="鎿嶄綔"--> - <!-- width="120"--> - <!-- fixed="right"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div class="operationClass">--> - - <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> - <!-- <i--> - <!-- class="el-icon-tickets"--> - <!-- :style="{color:$store.state.settings.theme}"--> - <!-- style="cursor: pointer;margin-right: 15px"--> - <!-- @click="edit(row)"--> - <!-- />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldUpDownMachinesSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - > - <template slot-scope="{row}"> - {{ row.chk_value ? row.chk_value : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - MouldCheckSubTakeSearch, - MouldCheckTakeOutExcel, MouldCirculateMachinesSearch, - MouldCirculateMachinesOutExcel, - MouldUpDownMachinesSearch -} from '@/api/MouldManager' - -export default { - name: 'MouldCirculateRecord', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldcode: '', - mouldname: '', - mouldspec: '', - - stanedname: '', - operuser: '', - type: '', - operdate: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - typeArr: [ - { code: 'UP', name: '涓婃満' }, - { code: 'DOWN', name: '涓嬫満' } - ], - total: 10, - tableData: [], - dialogVisible: false, - tableDataDialog: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldUpDownMachinesSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getMouldUpDownMachinesSearch() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - - operuser: this.form.operuser, - type: this.form.type, - operdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - console.log(data, 1) - const res = await MouldCirculateMachinesSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldUpDownMachinesSearch() - }, - async download() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - - operuser: this.form.operuser, - type: this.form.type, - operdate: tempDate - } - - const { data: res } = await MouldCirculateMachinesOutExcel(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMouldUpDownMachinesSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.mouldspec = '' - - this.form.operuser = '' - this.form.type = '' - this.form.operdate = '' - this.getMouldUpDownMachinesSearch() - }, - - // 淇敼鎸夐挳 - async edit(row) { - this.dialogVisible = true - - const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) - this.tableDataDialog = res - - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + + <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> + <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in typeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> + <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + label="鎿嶄綔鏃堕棿" + > + <el-date-picker + v-model="form.operdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + + <el-table-column + prop="mould_code" + label="妯″叿缂栫爜" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_name" + label="妯″叿鍚嶇О" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_spec" + label="浜у搧瑙勬牸" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.mould_spec">{{ row.mould_spec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="type" + label="鎿嶄綔绫诲瀷" + sortable="custom" + /> + <el-table-column + prop="description" + label="鍊熻繕鎻忚堪" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description?row.description:'/' }} + </template> + </el-table-column> + + <el-table-column + prop="lm_user" + label="鎿嶄綔浜�" + sortable="custom" + /> + + <el-table-column + prop="lm_date" + label="鎿嶄綔鏃堕棿" + sortable="custom" + /> + + <!-- <el-table-column--> + <!-- label="鎿嶄綔"--> + <!-- width="120"--> + <!-- fixed="right"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div class="operationClass">--> + + <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> + <!-- <i--> + <!-- class="el-icon-tickets"--> + <!-- :style="{color:$store.state.settings.theme}"--> + <!-- style="cursor: pointer;margin-right: 15px"--> + <!-- @click="edit(row)"--> + <!-- />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldUpDownMachinesSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + > + <template slot-scope="{row}"> + {{ row.chk_value ? row.chk_value : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + MouldCheckSubTakeSearch, + MouldCheckTakeOutExcel, MouldCirculateMachinesSearch, + MouldCirculateMachinesOutExcel, + MouldUpDownMachinesSearch +} from '@/api/MouldManager' + +export default { + name: 'MouldCirculateRecord', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldcode: '', + mouldname: '', + mouldspec: '', + + stanedname: '', + operuser: '', + type: '', + operdate: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + typeArr: [ + { code: 'UP', name: '涓婃満' }, + { code: 'DOWN', name: '涓嬫満' } + ], + total: 10, + tableData: [], + dialogVisible: false, + tableDataDialog: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldUpDownMachinesSearch() + }, + created() { + this.getMouldUpDownMachinesSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getMouldUpDownMachinesSearch() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + + operuser: this.form.operuser, + type: this.form.type, + operdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + console.log(data, 1) + const res = await MouldCirculateMachinesSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldUpDownMachinesSearch() + }, + async download() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + + operuser: this.form.operuser, + type: this.form.type, + operdate: tempDate + } + + const { data: res } = await MouldCirculateMachinesOutExcel(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMouldUpDownMachinesSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.mouldspec = '' + + this.form.operuser = '' + this.form.type = '' + this.form.operdate = '' + this.getMouldUpDownMachinesSearch() + }, + + // 淇敼鎸夐挳 + async edit(row) { + this.dialogVisible = true + + const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) + this.tableDataDialog = res + + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/mouldManager/mouldList.vue b/src/views/mouldManager/mouldList.vue index 64670ac..4e6b931 100644 --- a/src/views/mouldManager/mouldList.vue +++ b/src/views/mouldManager/mouldList.vue @@ -1,982 +1,989 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=12')" - >瀵煎叆 - </el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>--> - - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> - <el-select v-model="form.mouldstaus" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in mouldstausArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="浣跨敤鐘舵��" style=" display: flex;"> - <el-select v-model="form.usestatus" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in onstateArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="妯″叿缂栧彿" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.createuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.createdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="status" - label="妯″叿鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="row.status==='N'" size="small" type="danger">鏁呴殰</el-tag> - </template> - </el-table-column> - <el-table-column - prop="usestatus" - label="浣跨敤鐘舵��" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name:'/' }} - <!-- {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}--> - </template> - </el-table-column> - <el-table-column - prop="code" - label="妯″叿缂栧彿" - sortable="custom" - /> - <el-table-column - prop="name" - label="妯″叿鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="spec" - label="瑙勬牸鍨嬪彿" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.spec ? row.spec : '/' }} - </template> - </el-table-column> - <el-table-column - prop="warehousename" - label="浠撳簱鍚嶇О" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.warehousename ? row.warehousename : '/' }} - </template> - </el-table-column> - <el-table-column - prop="location_name" - label="搴撲綅鍚嶇О" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.location_name ? row.location_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="is_part" - label="浜у搧鍏宠仈" - sortable="custom" - > - <template slot-scope="{row}"> - <!-- <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>--> - <!-- <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>--> - <i - v-if="row.is_part==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - style="cursor: pointer" - @click="connectClick(row)" - /> - <i - v-if="row.is_part==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185);cursor:pointer;" - @click="connectClick(row)" - /> - </template> - </el-table-column> - <el-table-column - prop="surp_life" - label="棰勮瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="serlife" - label="浣跨敤瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="resi_life" - label="鍓╀綑瀵垮懡(娆�)" - width="125" - sortable="custom" - /> - <el-table-column - prop="username" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> - <div v-else>/</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit(row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="灞ュ巻" placement="top"> - <i class="el-icon-view" :style="{color:$store.state.settings.theme}" style="cursor: pointer" @click="view(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldMangerSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':(operation==='edit'?'缂栬緫':'浜у搧鍏宠仈')" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - :top="operation!=='connect'? '7vh':'15vh'" - class="dialogFormClass" - @closed="handleClose" - @close="handleClose" - > - - <el-form - v-if="operation!=='connect'" - ref="dialogForm" - class="" - inline - :rules="dialogFormRules" - :model="dialogForm" - label-width="110px" - > - <el-divider content-position="left">鍩烘湰淇℃伅</el-divider> - <el-form-item label="妯″叿缂栫爜" prop="mouldcode"> - <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" prop="mouldname"> - <el-input v-model="dialogForm.mouldname" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿"> - <el-input v-model="dialogForm.mouldspec" style="width: 200px" /> - </el-form-item> - - <el-form-item required label="妯″叿鐘舵��"> - <el-radio-group v-model="dialogForm.status"> - <el-radio label="Y">姝e父</el-radio> - <el-radio label="N">鏁呴殰</el-radio> - </el-radio-group> - </el-form-item> - - <el-form-item v-if="dialogForm.opertype==='Add'" prop="warehousecode" label="鎵�灞炰粨搴�"> - <el-select - v-model="dialogForm.warehousecode" - style="width:200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="warehousecodeChange" - > - <el-option - v-for="item in wareHouseArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item v-if="dialogForm.opertype==='Add'" prop="location_code" label="鎵�灞炲簱浣�"> - <el-select - v-model="dialogForm.location_code" - style="width:200px" - :disabled="dialogForm.warehousecode===''" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - > - <el-option - v-for="item in locationArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="棰勮瀵垮懡(娆�)"> - <el-input v-model="dialogForm.surplife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍓╀綑瀵垮懡(娆�)"> - <el-input v-model="dialogForm.resilife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - - </el-form> - <el-divider v-if="operation!=='connect'" content-position="left">鍏宠仈浜у搧</el-divider> - - <el-input - v-model="filterText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - /> - <div style="height: 300px;overflow:auto;margin-top: 25px;"> - <el-tree - ref="tree" - class="filter-tree" - :data="Inventory" - :props="defaultProps" - show-checkbox - node-key="code" - default-expand-all - :filter-node-method="filterNode" - /> - - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="灞ュ巻鏌ョ湅" - :visible.sync="dialogVisibleResume" - width="1000px" - :close-on-click-modal="false" - top="7vh" - class="dialogFormClass" - @closed="handleCloseResume" - > - <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder">妯″叿鍦ㄧ嚎淇℃伅鏌ヨ</div> - <el-descriptions class="margin-top" title=" " :column="3" size="size" border> - <!-- <template slot="extra">--> - <!-- <el-button type="primary" size="small">鎿嶄綔</el-button>--> - <!-- </template>--> - <el-descriptions-item> - <template slot="label"> - <!-- <i class="el-icon-user" />--> - 妯″叿缂栫爜 - </template> - {{ formResume.mouldcode }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 妯″叿鍚嶇О - </template> - {{ formResume.mouldname }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 瑙勬牸鍨嬪彿 - </template> - {{ formResume.mouldspec||'/' }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 妯″叿鐘舵�� - </template> - <!-- {{ formResume.status ==='Y'?'姝e父':'寮傚父' }}--> - <el-tag v-if="formResume.status==='Y'" size="small" type="success">姝e父</el-tag> - <el-tag v-if="formResume.status==='N'" size="small" type="danger">鏁呴殰</el-tag> - - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 浣跨敤鐘舵�� - </template> - <!-- {{ formResume.usestatus }}--> - {{ formResume.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(formResume.usestatus)).name:'/' }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 棰勮瀵垮懡(娆�) - </template> - {{ formResume.surp_life }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鍓╀綑瀵垮懡(娆�) - </template> - {{ formResume.serlife }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鏌ョ湅浜哄憳 - </template> - {{ formResume.username }} - </el-descriptions-item> - <el-descriptions-item> - <template slot="label"> - 鏌ョ湅鏃堕棿 - </template> - {{ formResume.lm_date }} - </el-descriptions-item> - </el-descriptions> - - <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder;margin: 20px 0">妯″叿娴佽浆璁板綍</div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef2" - class="tableFixed" - :data="tableResume" - height="370px" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:'370px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="opertype" - label="鎿嶄綔绫诲瀷" - /> - - <el-table-column - prop="operusername" - label="鎿嶄綔浜哄憳" - /> - - <el-table-column - prop="operdate" - label="鎿嶄綔鏃堕棿" - /> - <el-table-column - prop="opertype" - label="缁撴灉/瀵硅薄" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="totalResume" - :page.sync="formResume.page" - :limit.sync="formResume.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMoldResumeSearch" - /> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleResume=false">杩� 鍥�</el-button> - <!-- <el-button--> - <!-- v-waves--> - <!-- type="primary"--> - <!-- :loading="$store.state.app.buttonIsDisabled"--> - <!-- :disabled="$store.state.app.buttonIsDisabled"--> - <!-- @click="dialogVisibleConfirm"--> - <!-- >纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - ProductionScheduleReportExcelSearch, - ProductionScheduleReportSearch -} from '@/api/ReportManager' -import { AddUpdateMouldManger, DeleteMouldManger, MoldResumeSearch, MouldMangerSearch } from '@/api/MouldManager' -import { InventoryTreePermissions, WareHouse, WareHouseSelectLocation } from '@/api/GeneralBasicData' -import arrayToTree from 'array-to-tree' -import { TCunstomerDelete } from '@/api/basicSettings' - -export default { - name: 'MouldList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldstaus: '', // 妯″叿鐘舵�� - usestatus: '', // 浣跨敤鐘舵�� - mouldcode: '', // 妯″叿缂栫爜 - mouldname: '', // 妯″叿鍚嶇О - mouldspec: '', // 妯″叿瑙勬牸鍨嬪彿 - - createuser: '', // 鍒涘缓浜哄憳 - createdate: '', // 鍗曟嵁鏃ユ湡 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - - mouldstausArr: [ - { code: 'Y', name: '姝e父' }, - { code: 'N', name: '鏁呴殰' } - ], - onstateArr: [ - { code: 0, name: '鍦ㄥ簱' }, - { code: 1, name: '鍑哄簱' }, - { code: 2, name: '涓婃満' }, - { code: 3, name: '涓嬫満' }, - { code: 4, name: '寰呯淮淇�' }, - { code: 5, name: '宸茬淮淇�' }, - { code: 6, name: '宸查獙璇�' }, - { code: 7, name: '澶栧��' }, - { code: 8, name: '褰掕繕' } - ], - - total: 10, - tableData: [], - - operation: '', - dialogVisible: false, - dialogForm: { - mouldcode: '', - mouldname: '', - mouldspec: '', - warehousecode: '', // 浠撳簱缂栫爜 - location_code: '', // 搴撲綅缂栫爜 - surplife: '', - resilife: '', - status: 'Y', - mouldpart: '', - opertype: '' - }, - dialogFormRules: { - mouldcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - mouldname: [ - { required: true, message: '璇疯緭鍏ユā鍏峰悕绉�', trigger: ['blur', 'change'] } - ], - warehousecode: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] } - ], - location_code: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨搴撲綅淇℃伅', trigger: ['blur', 'change'] } - ] - }, - filterText: '', - defaultProps: { - children: 'children', - label: 'name' - }, - - Inventory: [ - // { code: '-1', - // name: '鍏ㄩ儴' - // } - ], - - wareHouseArr: [], // 浠撳簱鏁扮粍 - locationArr: [], // 搴撲綅鏁扮粍 - - dialogVisibleResume: false, - formResume: { - mouldcode: '', - page: 1, - rows: 20 - }, - tableResume: [], - totalResume: 10 - - } - }, - watch: { - filterText(val) { - this.$refs.tree.filter(val) - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldMangerSearch() - - this.getInventoryTreePermissions() - this.getWareHouse() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getInventoryTreePermissions() { - const res = await InventoryTreePermissions() - res.data.forEach(i => { - i.name = i.code + ' ' + i.name - }) - - this.Inventory = arrayToTree(res.data, { - parentProperty: 'parentid', - customID: 'code', - childrenProperty: 'children' - }) - }, - async getWareHouse() { - const { data: res } = await WareHouse() - this.wareHouseArr = res - }, - async getMouldMangerSearch() { - let tempDate = this.form.createdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - mouldstaus: this.form.mouldstaus, - mouldcode: this.form.mouldcode, - wkshopcode: this.form.wkshopcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - partname: this.form.partname, - partspec: this.form.partspec, - createdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - - const res = await MouldMangerSearch(data) - this.tableData = res.data - this.total = res.count - }, - - // 瀵煎嚭 - async download() { - let tempDate = this.form.createdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - mouldstaus: this.form.mouldstaus, - mouldcode: this.form.mouldcode, - wkshopcode: this.form.wkshopcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - partname: this.form.partname, - partspec: this.form.partspec, - createdate: tempDate - } - - const res = await ProductionScheduleReportExcelSearch(data) - // console.log(res) - window.location.href = res.data - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldMangerSearch() - }, - // 鏌ヨ - search() { - this.getMouldMangerSearch() - }, - // 閲嶇疆 - reset() { - this.form.mouldstaus = '' - this.form.usestatus = '' - this.form.mouldcode = '' - this.form.mouldname = '' - - this.form.mouldspec = '' - this.form.createuser = '' - this.form.createdate = '' - this.getMouldMangerSearch() - }, - async warehousecodeChange(val) { - const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) - this.locationArr = res - }, - add() { - this.operation = 'add' - this.dialogForm.opertype = 'Add' - this.dialogVisible = true - }, - edit(row) { - this.operation = 'edit' - this.dialogVisible = true - this.dialogForm.opertype = 'Update' - - this.$nextTick(() => { - this.dialogForm.mouldcode = row.code - this.dialogForm.mouldname = row.name - this.dialogForm.mouldspec = row.spec - this.dialogForm.warehousecode = row.warehousecode - this.dialogForm.location_code = row.location_code - this.dialogForm.surplife = row.surp_life - this.dialogForm.resilife = row.resi_life - this.dialogForm.status = row.status - this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] - this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) - }) - }, - connectClick(row) { - this.operation = 'connect' - this.dialogVisible = true - this.dialogForm.opertype = 'Update' - - this.$nextTick(() => { - this.dialogForm.mouldcode = row.code - this.dialogForm.mouldname = row.name - this.dialogForm.mouldspec = row.spec - // this.dialogForm.warehousecode = row.warehousecode - this.dialogForm.surplife = row.surp_life - this.dialogForm.resilife = row.resi_life - this.dialogForm.status = row.status - this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] - this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) - }) - }, - del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldManger({ mouldcode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - this.getMouldMangerSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 灞ュ巻 - async view(row) { - this.formResume.mouldcode = row.code - this.formResume.mouldname = row.name - this.formResume.mouldspec = row.spec - this.formResume.username = localStorage.getItem('username') - this.formResume.surp_life = row.surp_life - this.formResume.serlife = row.serlife - this.formResume.lm_date = handleDatetime2(new Date()) - this.formResume.status = row.status - this.formResume.usestatus = row.usestatus - - await this.getMoldResumeSearch() - this.dialogVisibleResume = true - this.$nextTick(() => { - this.$refs.tableDataRef2.doLayout() - }) - }, - async getMoldResumeSearch() { - const data = { - mouldcode: this.formResume.mouldcode, - createdate: '', - page: this.formResume.page, - rows: this.formResume.rows, - prop: 'operdate', - order: 'desc' - } - const res = await MoldResumeSearch(data) - - if (res.code === '200') { - this.tableResume = res.data - this.totalResume = res.count - } - }, - - handleCloseResume() { - this.tableResume = [] - }, - - handleClose() { - this.dialogForm = { - mouldcode: '', - mouldname: '', - mouldspec: '', - warehousecode: '', - location_code: '', - surplife: '', - resilife: '', - status: 'Y', - mouldpart: '', - opertype: '' - } - if (this.operation !== 'connect') { - this.$refs.dialogForm.clearValidate() - } - }, - dialogVisibleCancel() { - this.dialogVisible = false - }, - dialogVisibleConfirm() { - if (this.operation !== 'connect') { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const checkData = this.$refs.tree.getCheckedNodes() - this.dialogForm.mouldpart = [] - checkData.forEach(item => { - if (!Object.keys(item).includes('children')) { - this.dialogForm.mouldpart.push(item.code) - } - }) - // if (this.dialogForm.mouldpart.length === 0) { - // return this.$message.info('鍏宠仈浜у搧涓嶈兘涓虹┖锛�') - // } - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldManger(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.$refs.tree.setCheckedKeys([]) - - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getMouldMangerSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - } else { - const checkData = this.$refs.tree.getCheckedNodes() - this.dialogForm.mouldpart = [] - checkData.forEach(item => { - if (!Object.keys(item).includes('children')) { - this.dialogForm.mouldpart.push(item.code) - } - }) - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldManger(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success('鍏宠仈鎴愬姛锛�') - this.$refs.tree.setCheckedKeys([]) - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getMouldMangerSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error('鍏宠仈澶辫触锛�') - } - }) - } - }, - filterNode(value, data) { - if (!value) return true - return data.name.indexOf(value) !== -1 - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } - -} -</script> -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} - -.dialogFormClass ::v-deep .el-form-item { - margin-bottom: 0; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=12')" + >瀵煎叆 + </el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>--> + + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> + <el-select v-model="form.mouldstaus" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in mouldstausArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="浣跨敤鐘舵��" style=" display: flex;"> + <el-select v-model="form.usestatus" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in onstateArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="妯″叿缂栧彿" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.createuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.createdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="status" + label="妯″叿鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="row.status==='N'" size="small" type="danger">鏁呴殰</el-tag> + </template> + </el-table-column> + <el-table-column + prop="usestatus" + label="浣跨敤鐘舵��" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name:'/' }} + <!-- {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}--> + </template> + </el-table-column> + <el-table-column + prop="code" + label="妯″叿缂栧彿" + sortable="custom" + /> + <el-table-column + prop="name" + label="妯″叿鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="spec" + label="瑙勬牸鍨嬪彿" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.spec ? row.spec : '/' }} + </template> + </el-table-column> + <el-table-column + prop="warehousename" + label="浠撳簱鍚嶇О" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.warehousename ? row.warehousename : '/' }} + </template> + </el-table-column> + <el-table-column + prop="location_name" + label="搴撲綅鍚嶇О" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.location_name ? row.location_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="is_part" + label="浜у搧鍏宠仈" + sortable="custom" + > + <template slot-scope="{row}"> + <!-- <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>--> + <!-- <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>--> + <i + v-if="row.is_part==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + style="cursor: pointer" + @click="connectClick(row)" + /> + <i + v-if="row.is_part==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185);cursor:pointer;" + @click="connectClick(row)" + /> + </template> + </el-table-column> + <el-table-column + prop="surp_life" + label="棰勮瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="serlife" + label="浣跨敤瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="resi_life" + label="鍓╀綑瀵垮懡(娆�)" + width="125" + sortable="custom" + /> + <el-table-column + prop="username" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> + <div v-else>/</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit(row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="灞ュ巻" placement="top"> + <i class="el-icon-view" :style="{color:$store.state.settings.theme}" style="cursor: pointer" @click="view(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldMangerSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':(operation==='edit'?'缂栬緫':'浜у搧鍏宠仈')" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + :top="operation!=='connect'? '7vh':'15vh'" + class="dialogFormClass" + @closed="handleClose" + @close="handleClose" + > + + <el-form + v-if="operation!=='connect'" + ref="dialogForm" + class="" + inline + :rules="dialogFormRules" + :model="dialogForm" + label-width="110px" + > + <el-divider content-position="left">鍩烘湰淇℃伅</el-divider> + <el-form-item label="妯″叿缂栫爜" prop="mouldcode"> + <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" prop="mouldname"> + <el-input v-model="dialogForm.mouldname" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿"> + <el-input v-model="dialogForm.mouldspec" style="width: 200px" /> + </el-form-item> + + <el-form-item required label="妯″叿鐘舵��"> + <el-radio-group v-model="dialogForm.status"> + <el-radio label="Y">姝e父</el-radio> + <el-radio label="N">鏁呴殰</el-radio> + </el-radio-group> + </el-form-item> + + <el-form-item v-if="dialogForm.opertype==='Add'" prop="warehousecode" label="鎵�灞炰粨搴�"> + <el-select + v-model="dialogForm.warehousecode" + style="width:200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="warehousecodeChange" + > + <el-option + v-for="item in wareHouseArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item v-if="dialogForm.opertype==='Add'" prop="location_code" label="鎵�灞炲簱浣�"> + <el-select + v-model="dialogForm.location_code" + style="width:200px" + :disabled="dialogForm.warehousecode===''" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + > + <el-option + v-for="item in locationArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="棰勮瀵垮懡(娆�)"> + <el-input v-model="dialogForm.surplife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍓╀綑瀵垮懡(娆�)"> + <el-input v-model="dialogForm.resilife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + + </el-form> + <el-divider v-if="operation!=='connect'" content-position="left">鍏宠仈浜у搧</el-divider> + + <el-input + v-model="filterText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + /> + <div style="height: 300px;overflow:auto;margin-top: 25px;"> + <el-tree + ref="tree" + class="filter-tree" + :data="Inventory" + :props="defaultProps" + show-checkbox + node-key="code" + default-expand-all + :filter-node-method="filterNode" + /> + + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="灞ュ巻鏌ョ湅" + :visible.sync="dialogVisibleResume" + width="1000px" + :close-on-click-modal="false" + top="7vh" + class="dialogFormClass" + @closed="handleCloseResume" + > + <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder">妯″叿鍦ㄧ嚎淇℃伅鏌ヨ</div> + <el-descriptions class="margin-top" title=" " :column="3" size="size" border> + <!-- <template slot="extra">--> + <!-- <el-button type="primary" size="small">鎿嶄綔</el-button>--> + <!-- </template>--> + <el-descriptions-item> + <template slot="label"> + <!-- <i class="el-icon-user" />--> + 妯″叿缂栫爜 + </template> + {{ formResume.mouldcode }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 妯″叿鍚嶇О + </template> + {{ formResume.mouldname }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 瑙勬牸鍨嬪彿 + </template> + {{ formResume.mouldspec||'/' }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 妯″叿鐘舵�� + </template> + <!-- {{ formResume.status ==='Y'?'姝e父':'寮傚父' }}--> + <el-tag v-if="formResume.status==='Y'" size="small" type="success">姝e父</el-tag> + <el-tag v-if="formResume.status==='N'" size="small" type="danger">鏁呴殰</el-tag> + + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 浣跨敤鐘舵�� + </template> + <!-- {{ formResume.usestatus }}--> + {{ formResume.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(formResume.usestatus)).name:'/' }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 棰勮瀵垮懡(娆�) + </template> + {{ formResume.surp_life }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鍓╀綑瀵垮懡(娆�) + </template> + {{ formResume.serlife }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鏌ョ湅浜哄憳 + </template> + {{ formResume.username }} + </el-descriptions-item> + <el-descriptions-item> + <template slot="label"> + 鏌ョ湅鏃堕棿 + </template> + {{ formResume.lm_date }} + </el-descriptions-item> + </el-descriptions> + + <div style="display: flex;justify-content: center;font-size: 18px;font-weight: bolder;margin: 20px 0">妯″叿娴佽浆璁板綍</div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef2" + class="tableFixed" + :data="tableResume" + height="370px" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:'370px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="opertype" + label="鎿嶄綔绫诲瀷" + /> + + <el-table-column + prop="operusername" + label="鎿嶄綔浜哄憳" + /> + + <el-table-column + prop="operdate" + label="鎿嶄綔鏃堕棿" + /> + <el-table-column + prop="opertype" + label="缁撴灉/瀵硅薄" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="totalResume" + :page.sync="formResume.page" + :limit.sync="formResume.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMoldResumeSearch" + /> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleResume=false">杩� 鍥�</el-button> + <!-- <el-button--> + <!-- v-waves--> + <!-- type="primary"--> + <!-- :loading="$store.state.app.buttonIsDisabled"--> + <!-- :disabled="$store.state.app.buttonIsDisabled"--> + <!-- @click="dialogVisibleConfirm"--> + <!-- >纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + ProductionScheduleReportExcelSearch, + ProductionScheduleReportSearch +} from '@/api/ReportManager' +import { AddUpdateMouldManger, DeleteMouldManger, MoldResumeSearch, MouldMangerSearch } from '@/api/MouldManager' +import { InventoryTreePermissions, WareHouse, WareHouseSelectLocation } from '@/api/GeneralBasicData' +import arrayToTree from 'array-to-tree' +import { TCunstomerDelete } from '@/api/basicSettings' + +export default { + name: 'MouldList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldstaus: '', // 妯″叿鐘舵�� + usestatus: '', // 浣跨敤鐘舵�� + mouldcode: '', // 妯″叿缂栫爜 + mouldname: '', // 妯″叿鍚嶇О + mouldspec: '', // 妯″叿瑙勬牸鍨嬪彿 + + createuser: '', // 鍒涘缓浜哄憳 + createdate: '', // 鍗曟嵁鏃ユ湡 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + + mouldstausArr: [ + { code: 'Y', name: '姝e父' }, + { code: 'N', name: '鏁呴殰' } + ], + onstateArr: [ + { code: 0, name: '鍦ㄥ簱' }, + { code: 1, name: '鍑哄簱' }, + { code: 2, name: '涓婃満' }, + { code: 3, name: '涓嬫満' }, + { code: 4, name: '寰呯淮淇�' }, + { code: 5, name: '宸茬淮淇�' }, + { code: 6, name: '宸查獙璇�' }, + { code: 7, name: '澶栧��' }, + { code: 8, name: '褰掕繕' } + ], + + total: 10, + tableData: [], + + operation: '', + dialogVisible: false, + dialogForm: { + mouldcode: '', + mouldname: '', + mouldspec: '', + warehousecode: '', // 浠撳簱缂栫爜 + location_code: '', // 搴撲綅缂栫爜 + surplife: '', + resilife: '', + status: 'Y', + mouldpart: '', + opertype: '' + }, + dialogFormRules: { + mouldcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + mouldname: [ + { required: true, message: '璇疯緭鍏ユā鍏峰悕绉�', trigger: ['blur', 'change'] } + ], + warehousecode: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] } + ], + location_code: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨搴撲綅淇℃伅', trigger: ['blur', 'change'] } + ] + }, + filterText: '', + defaultProps: { + children: 'children', + label: 'name' + }, + + Inventory: [ + // { code: '-1', + // name: '鍏ㄩ儴' + // } + ], + + wareHouseArr: [], // 浠撳簱鏁扮粍 + locationArr: [], // 搴撲綅鏁扮粍 + + dialogVisibleResume: false, + formResume: { + mouldcode: '', + page: 1, + rows: 20 + }, + tableResume: [], + totalResume: 10 + + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldMangerSearch() + this.getInventoryTreePermissions() + this.getWareHouse() + }, + created() { + this.getMouldMangerSearch() + + this.getInventoryTreePermissions() + this.getWareHouse() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getInventoryTreePermissions() { + const res = await InventoryTreePermissions() + res.data.forEach(i => { + i.name = i.code + ' ' + i.name + }) + + this.Inventory = arrayToTree(res.data, { + parentProperty: 'parentid', + customID: 'code', + childrenProperty: 'children' + }) + }, + async getWareHouse() { + const { data: res } = await WareHouse() + this.wareHouseArr = res + }, + async getMouldMangerSearch() { + let tempDate = this.form.createdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + mouldstaus: this.form.mouldstaus, + mouldcode: this.form.mouldcode, + wkshopcode: this.form.wkshopcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + partname: this.form.partname, + partspec: this.form.partspec, + createdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + + const res = await MouldMangerSearch(data) + this.tableData = res.data + this.total = res.count + }, + + // 瀵煎嚭 + async download() { + let tempDate = this.form.createdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + mouldstaus: this.form.mouldstaus, + mouldcode: this.form.mouldcode, + wkshopcode: this.form.wkshopcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + partname: this.form.partname, + partspec: this.form.partspec, + createdate: tempDate + } + + const res = await ProductionScheduleReportExcelSearch(data) + // console.log(res) + window.location.href = res.data + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldMangerSearch() + }, + // 鏌ヨ + search() { + this.getMouldMangerSearch() + }, + // 閲嶇疆 + reset() { + this.form.mouldstaus = '' + this.form.usestatus = '' + this.form.mouldcode = '' + this.form.mouldname = '' + + this.form.mouldspec = '' + this.form.createuser = '' + this.form.createdate = '' + this.getMouldMangerSearch() + }, + async warehousecodeChange(val) { + const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) + this.locationArr = res + }, + add() { + this.operation = 'add' + this.dialogForm.opertype = 'Add' + this.dialogVisible = true + }, + edit(row) { + this.operation = 'edit' + this.dialogVisible = true + this.dialogForm.opertype = 'Update' + + this.$nextTick(() => { + this.dialogForm.mouldcode = row.code + this.dialogForm.mouldname = row.name + this.dialogForm.mouldspec = row.spec + this.dialogForm.warehousecode = row.warehousecode + this.dialogForm.location_code = row.location_code + this.dialogForm.surplife = row.surp_life + this.dialogForm.resilife = row.resi_life + this.dialogForm.status = row.status + this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] + this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) + }) + }, + connectClick(row) { + this.operation = 'connect' + this.dialogVisible = true + this.dialogForm.opertype = 'Update' + + this.$nextTick(() => { + this.dialogForm.mouldcode = row.code + this.dialogForm.mouldname = row.name + this.dialogForm.mouldspec = row.spec + // this.dialogForm.warehousecode = row.warehousecode + this.dialogForm.surplife = row.surp_life + this.dialogForm.resilife = row.resi_life + this.dialogForm.status = row.status + this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] + this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) + }) + }, + del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldManger({ mouldcode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + this.getMouldMangerSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 灞ュ巻 + async view(row) { + this.formResume.mouldcode = row.code + this.formResume.mouldname = row.name + this.formResume.mouldspec = row.spec + this.formResume.username = localStorage.getItem('username') + this.formResume.surp_life = row.surp_life + this.formResume.serlife = row.serlife + this.formResume.lm_date = handleDatetime2(new Date()) + this.formResume.status = row.status + this.formResume.usestatus = row.usestatus + + await this.getMoldResumeSearch() + this.dialogVisibleResume = true + this.$nextTick(() => { + this.$refs.tableDataRef2.doLayout() + }) + }, + async getMoldResumeSearch() { + const data = { + mouldcode: this.formResume.mouldcode, + createdate: '', + page: this.formResume.page, + rows: this.formResume.rows, + prop: 'operdate', + order: 'desc' + } + const res = await MoldResumeSearch(data) + + if (res.code === '200') { + this.tableResume = res.data + this.totalResume = res.count + } + }, + + handleCloseResume() { + this.tableResume = [] + }, + + handleClose() { + this.dialogForm = { + mouldcode: '', + mouldname: '', + mouldspec: '', + warehousecode: '', + location_code: '', + surplife: '', + resilife: '', + status: 'Y', + mouldpart: '', + opertype: '' + } + if (this.operation !== 'connect') { + this.$refs.dialogForm.clearValidate() + } + }, + dialogVisibleCancel() { + this.dialogVisible = false + }, + dialogVisibleConfirm() { + if (this.operation !== 'connect') { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const checkData = this.$refs.tree.getCheckedNodes() + this.dialogForm.mouldpart = [] + checkData.forEach(item => { + if (!Object.keys(item).includes('children')) { + this.dialogForm.mouldpart.push(item.code) + } + }) + // if (this.dialogForm.mouldpart.length === 0) { + // return this.$message.info('鍏宠仈浜у搧涓嶈兘涓虹┖锛�') + // } + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldManger(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.$refs.tree.setCheckedKeys([]) + + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getMouldMangerSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + } else { + const checkData = this.$refs.tree.getCheckedNodes() + this.dialogForm.mouldpart = [] + checkData.forEach(item => { + if (!Object.keys(item).includes('children')) { + this.dialogForm.mouldpart.push(item.code) + } + }) + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldManger(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success('鍏宠仈鎴愬姛锛�') + this.$refs.tree.setCheckedKeys([]) + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getMouldMangerSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error('鍏宠仈澶辫触锛�') + } + }) + } + }, + filterNode(value, data) { + if (!value) return true + return data.name.indexOf(value) !== -1 + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } + +} +</script> +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} + +.dialogFormClass ::v-deep .el-form-item { + margin-bottom: 0; +} +</style> diff --git a/src/views/mouldManager/mouldMaintain.vue b/src/views/mouldManager/mouldMaintain.vue index a68d831..596f481 100644 --- a/src/views/mouldManager/mouldMaintain.vue +++ b/src/views/mouldManager/mouldMaintain.vue @@ -1,453 +1,458 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=14')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.maiitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> - <el-input v-model="form.maiitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="淇濆吇鎻忚堪" style=" display: flex;"> - <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldMaiItemSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="閮ㄤ綅缂栫爜" prop="maiitemcode"> - <el-input v-model="dialogForm.maiitemcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="閮ㄤ綅鍚嶇О" prop="maiitemname"> - <el-input v-model="dialogForm.maiitemname" style="width: 200px" /> - </el-form-item> - <el-form-item label="淇濆吇鎻忚堪" prop="maidescr"> - <el-input v-model="dialogForm.maidescr" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import ImportPicker from '@/components/ImportPicker' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { - AddUpdateMouldMaiItem, - DeleteMouldMaiItem, - MouldMaiItemSearch -} from '@/api/MouldManager' - -export default { - name: 'MouldMaintain', - components: { - Pagination, ImportPicker, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - maiitemcode: '', // 閮ㄤ綅缂栫爜 - maiitemname: '', // 閮ㄤ綅鍚嶇О - checkdescr: '', // 淇濆吇鎻忚堪 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '閮ㄤ綅缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '閮ㄤ綅鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '淇濆吇鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - // { - // minWidth: false, - // width: 110, - // prop: 'isscan', - // label: '閫夋嫨鎵爜', - // id: 6, - // show: true, - // fixed: false, - // sortable: true - // }, - // { - // minWidth: false, - // width: 110, - // prop: 'cycle', - // label: '鐐规鍛ㄦ湡', - // id: 7, - // show: true, - // fixed: false, - // sortable: true - // }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - id: '', - maiitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 - maiitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О - maidescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 - operType: '' // 鎿嶄綔绫诲瀷 - }, - operation: '', - dialogFormRules: { - maiitemcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - maiitemname: [ - { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } - ] - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '10', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldMaiItemSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getMouldMaiItemSearch() { - const res = await MouldMaiItemSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldMaiItemSearch() - }, - // 鏌ヨ - search() { - this.getMouldMaiItemSearch() - }, - // 閲嶇疆 - reset() { - this.form.maiitemcode = '' - this.form.maiitemname = '' - this.form.checkdescr = '' - this.getMouldMaiItemSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.id = row.id - this.dialogForm.maiitemcode = row.code - this.dialogForm.maiitemname = row.name - this.dialogForm.maidescr = row.description - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldMaiItem({ maiitemcode: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getMouldMaiItemSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.id = '' - this.dialogForm.maiitemcode = '' - this.dialogForm.maiitemname = '' - this.dialogForm.maidescr = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - id: this.dialogForm.id, - maiitemcode: this.dialogForm.maiitemcode, - maiitemname: this.dialogForm.maiitemname, - maiitemdescr: this.dialogForm.maidescr, - opertype: this.operation === 'add' ? 'Add' : 'Update' - } - // console.log(JSON.stringify(data), 1) - AddUpdateMouldMaiItem(data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getMouldMaiItemSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 240 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - } - } -} -</script> - +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=14')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="閮ㄤ綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.maiitemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" style=" display: flex;"> + <el-input v-model="form.maiitemname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="淇濆吇鎻忚堪" style=" display: flex;"> + <el-input v-model="form.checkdescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldMaiItemSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="閮ㄤ綅缂栫爜" prop="maiitemcode"> + <el-input v-model="dialogForm.maiitemcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="閮ㄤ綅鍚嶇О" prop="maiitemname"> + <el-input v-model="dialogForm.maiitemname" style="width: 200px" /> + </el-form-item> + <el-form-item label="淇濆吇鎻忚堪" prop="maidescr"> + <el-input v-model="dialogForm.maidescr" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import ImportPicker from '@/components/ImportPicker' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { + AddUpdateMouldMaiItem, + DeleteMouldMaiItem, + MouldMaiItemSearch +} from '@/api/MouldManager' + +export default { + name: 'MouldMaintain', + components: { + Pagination, ImportPicker, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + maiitemcode: '', // 閮ㄤ綅缂栫爜 + maiitemname: '', // 閮ㄤ綅鍚嶇О + checkdescr: '', // 淇濆吇鎻忚堪 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '閮ㄤ綅缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '閮ㄤ綅鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '淇濆吇鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + // { + // minWidth: false, + // width: 110, + // prop: 'isscan', + // label: '閫夋嫨鎵爜', + // id: 6, + // show: true, + // fixed: false, + // sortable: true + // }, + // { + // minWidth: false, + // width: 110, + // prop: 'cycle', + // label: '鐐规鍛ㄦ湡', + // id: 7, + // show: true, + // fixed: false, + // sortable: true + // }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + id: '', + maiitemcode: '', // 璁惧鐐规閮ㄤ綅缂栫爜 + maiitemname: '', // 璁惧鐐规閮ㄤ綅鍚嶇О + maidescr: '', // 璁惧鐐规閮ㄤ綅瑕佹眰 + operType: '' // 鎿嶄綔绫诲瀷 + }, + operation: '', + dialogFormRules: { + maiitemcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + maiitemname: [ + { required: true, message: '璇疯緭鍏ラ儴浣嶅悕绉�', trigger: ['blur', 'change'] } + ] + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '10', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldMaiItemSearch() + }, + created() { + this.getMouldMaiItemSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getMouldMaiItemSearch() { + const res = await MouldMaiItemSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldMaiItemSearch() + }, + // 鏌ヨ + search() { + this.getMouldMaiItemSearch() + }, + // 閲嶇疆 + reset() { + this.form.maiitemcode = '' + this.form.maiitemname = '' + this.form.checkdescr = '' + this.getMouldMaiItemSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.id = row.id + this.dialogForm.maiitemcode = row.code + this.dialogForm.maiitemname = row.name + this.dialogForm.maidescr = row.description + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldMaiItem({ maiitemcode: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getMouldMaiItemSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.id = '' + this.dialogForm.maiitemcode = '' + this.dialogForm.maiitemname = '' + this.dialogForm.maidescr = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + id: this.dialogForm.id, + maiitemcode: this.dialogForm.maiitemcode, + maiitemname: this.dialogForm.maiitemname, + maiitemdescr: this.dialogForm.maidescr, + opertype: this.operation === 'add' ? 'Add' : 'Update' + } + // console.log(JSON.stringify(data), 1) + AddUpdateMouldMaiItem(data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getMouldMaiItemSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 240 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + } + } +} +</script> + diff --git a/src/views/mouldManager/mouldMaintainRecord.vue b/src/views/mouldManager/mouldMaintainRecord.vue index 957487f..0e62a0d 100644 --- a/src/views/mouldManager/mouldMaintainRecord.vue +++ b/src/views/mouldManager/mouldMaintainRecord.vue @@ -1,492 +1,497 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item label="淇濆吇鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.stanedcode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="淇濆吇鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stanedname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="淇濆吇浜哄憳" style=" display: flex;"> - <el-input v-model="form.repairuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - label="淇濆吇鏃堕棿" - > - <el-date-picker - v-model="form.repairdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - - <el-form-item v-show="isExpandForm" label="淇濆吇缁撴灉" style=" display: flex;"> - <el-select v-model="form.repairresult" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checkrequestArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="bywo" - label="淇濆吇鍗曞彿" - sortable="custom" - /> - <el-table-column - prop="mould_code" - label="妯″叿缂栫爜" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_name" - label="妯″叿鍚嶇О" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_spec" - label="浜у搧瑙勬牸" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.mould_spec">{{ row.mould_spec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="stanedcode" - label="鐐规鏍囧噯缂栫爜" - sortable="custom" - /> - <el-table-column - prop="stanedname" - label="鐐规鏍囧噯鍚嶇О" - sortable="custom" - /> - - <el-table-column - prop="maint_user" - label="鐐规浜哄憳" - sortable="custom" - /> - <el-table-column - prop="maint_result" - label="鐐规缁撴灉" - sortable="custom" - > - <template slot-scope="{row}"> - <el-tag v-if="row.maint_result==='OK'" size="small" type="success">鍚堟牸</el-tag> - <el-tag v-if="row.maint_result==='NG'" size="small" type="danger">寮傚父</el-tag> - </template> - </el-table-column> - - <el-table-column - prop="maint_date" - label="鐐规鏃堕棿" - sortable="custom" - /> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - - <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top"> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldRepairTakeSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - > - <template slot-scope="{row}"> - {{ row.chk_value ? row.chk_value : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - MouldRepairSubTakeSearch, - MouldRepairTakeOutExcel, - MouldRepairTakeSearch -} from '@/api/MouldManager' - -export default { - name: 'MouldMaintainRecord', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldcode: '', - mouldname: '', - mouldspec: '', - stanedcode: '', - stanedname: '', - repairuser: '', - repairresult: '', - repairdate: '', - prop: 'maint_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkrequestArr: [ - { code: 'OK', name: '鍚堟牸' }, - { code: 'NG', name: '寮傚父' } - ], - total: 10, - tableData: [], - dialogVisible: false, - tableDataDialog: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldRepairTakeSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getMouldRepairTakeSearch() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - stanedcode: this.form.stanedcode, - stanedname: this.form.stanedname, - repairuser: this.form.repairuser, - repairresult: this.form.repairresult, - repairdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - console.log(data, 1) - const res = await MouldRepairTakeSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldRepairTakeSearch() - }, - async download() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - stanedcode: this.form.stanedcode, - stanedname: this.form.stanedname, - repairuser: this.form.repairuser, - repairresult: this.form.repairresult, - repairdate: tempDate - } - - const { data: res } = await MouldRepairTakeOutExcel(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMouldRepairTakeSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.mouldspec = '' - this.form.stanedcode = '' - this.form.stanedname = '' - this.form.repairuser = '' - this.form.repairresult = '' - this.form.repairdate = '' - this.getMouldRepairTakeSearch() - }, - - // 淇敼鎸夐挳 - async edit(row) { - this.dialogVisible = true - - const { data: res } = await MouldRepairSubTakeSearch({ id: row.id }) - this.tableDataDialog = res - - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item label="淇濆吇鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.stanedcode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="淇濆吇鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stanedname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="淇濆吇浜哄憳" style=" display: flex;"> + <el-input v-model="form.repairuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + label="淇濆吇鏃堕棿" + > + <el-date-picker + v-model="form.repairdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + + <el-form-item v-show="isExpandForm" label="淇濆吇缁撴灉" style=" display: flex;"> + <el-select v-model="form.repairresult" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checkrequestArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="bywo" + label="淇濆吇鍗曞彿" + sortable="custom" + /> + <el-table-column + prop="mould_code" + label="妯″叿缂栫爜" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_name" + label="妯″叿鍚嶇О" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_spec" + label="浜у搧瑙勬牸" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.mould_spec">{{ row.mould_spec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="stanedcode" + label="鐐规鏍囧噯缂栫爜" + sortable="custom" + /> + <el-table-column + prop="stanedname" + label="鐐规鏍囧噯鍚嶇О" + sortable="custom" + /> + + <el-table-column + prop="maint_user" + label="鐐规浜哄憳" + sortable="custom" + /> + <el-table-column + prop="maint_result" + label="鐐规缁撴灉" + sortable="custom" + > + <template slot-scope="{row}"> + <el-tag v-if="row.maint_result==='OK'" size="small" type="success">鍚堟牸</el-tag> + <el-tag v-if="row.maint_result==='NG'" size="small" type="danger">寮傚父</el-tag> + </template> + </el-table-column> + + <el-table-column + prop="maint_date" + label="鐐规鏃堕棿" + sortable="custom" + /> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + + <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top"> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldRepairTakeSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + > + <template slot-scope="{row}"> + {{ row.chk_value ? row.chk_value : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + MouldRepairSubTakeSearch, + MouldRepairTakeOutExcel, + MouldRepairTakeSearch +} from '@/api/MouldManager' + +export default { + name: 'MouldMaintainRecord', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldcode: '', + mouldname: '', + mouldspec: '', + stanedcode: '', + stanedname: '', + repairuser: '', + repairresult: '', + repairdate: '', + prop: 'maint_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkrequestArr: [ + { code: 'OK', name: '鍚堟牸' }, + { code: 'NG', name: '寮傚父' } + ], + total: 10, + tableData: [], + dialogVisible: false, + tableDataDialog: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldRepairTakeSearch() + }, + created() { + this.getMouldRepairTakeSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getMouldRepairTakeSearch() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + stanedcode: this.form.stanedcode, + stanedname: this.form.stanedname, + repairuser: this.form.repairuser, + repairresult: this.form.repairresult, + repairdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + console.log(data, 1) + const res = await MouldRepairTakeSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldRepairTakeSearch() + }, + async download() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + stanedcode: this.form.stanedcode, + stanedname: this.form.stanedname, + repairuser: this.form.repairuser, + repairresult: this.form.repairresult, + repairdate: tempDate + } + + const { data: res } = await MouldRepairTakeOutExcel(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMouldRepairTakeSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.mouldspec = '' + this.form.stanedcode = '' + this.form.stanedname = '' + this.form.repairuser = '' + this.form.repairresult = '' + this.form.repairdate = '' + this.getMouldRepairTakeSearch() + }, + + // 淇敼鎸夐挳 + async edit(row) { + this.dialogVisible = true + + const { data: res } = await MouldRepairSubTakeSearch({ id: row.id }) + this.tableDataDialog = res + + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/mouldManager/mouldMaintainStand.vue b/src/views/mouldManager/mouldMaintainStand.vue index ec0705a..ff2ceba 100644 --- a/src/views/mouldManager/mouldMaintainStand.vue +++ b/src/views/mouldManager/mouldMaintainStand.vue @@ -1,713 +1,718 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=14_1')" - >瀵煎叆 - </el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.repairstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.repairstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> - <el-input v-model="form.repairstandescr" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - style="height:5px" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='is_repairmould'"> - <i - v-if="row[item.prop]==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - style="cursor: pointer" - @click="connectClick(row)" - /> - <i - v-if="row[item.prop]==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185);cursor:pointer;" - @click="connectClick(row)" - /> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - :style="{color:$store.state.settings.theme}" - class="el-icon-edit-outline" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldRepairStandArdSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="1100px" - :close-on-click-modal="false" - top="8vh" - @closed="handleClose" - @close="handleClose" - > - <div style="margin: 0 30px;"> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-divider content-position="left">妯″叿淇濆吇鏍囧噯淇℃伅</el-divider> - - <el-form-item label="鏍囧噯缂栫爜" prop="code"> - <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" prop="description"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - </div> - <el-divider content-position="left">鎸囧畾淇濆吇椤逛俊鎭�</el-divider> - <div style="display: flex;align-items: center"> - <!-- <div style="font-weight: bolder">鐐规椤归�夋嫨锛�</div>--> - <el-drag-select - v-model="checkSelectedValue" - style="width:940px;" - multiple - placeholder="璇烽�夋嫨鐩稿搴旀寚瀹氶」" - > - <el-option - v-for="item in checkSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-drag-select> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataDialogRef" - :data="tableDataDialog" - :height="(tableHeight-300)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-300)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - label="搴忓彿" - /> - <el-table-column - prop="code" - width="150" - label="鐐规閮ㄤ綅缂栫爜" - show-tooltip-when-overflow - /> - <el-table-column - prop="name" - label="鐐规閮ㄤ綅鍚嶇О" - width="150" - show-tooltip-when-overflow - /> - - <el-table-column - prop="description" - label="鐐规瑕佹眰" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <el-input v-model="row.description" /> - </template> - </el-table-column> - - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <el-dialog - v-el-drag-dialog - title="鍏宠仈妯″叿" - :visible.sync="mouldDialogVisible" - width="800px" - :close-on-click-modal="false" - top="8vh" - @closed="handleMouldClose" - @close="handleMouldClose" - > - <div> - <el-input - v-model="filterText" - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - /> - <el-tree - ref="tree" - class="filter-tree" - :data="tree" - :props="defaultProps" - show-checkbox - node-key="code" - style="margin-top:15px;height: 550px;overflow: auto" - default-expand-all - :filter-node-method="filterNode" - /> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="mouldDialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="mouldDialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { - AddUpdateMouldRepairStandArd, - DeleteMouldRepairStaned, - MouldRepairStandArdSearch, - RepairStanedAssociationMould, - SaveRepairStanedAssociationMould, - ViewMouldRepairStanedSearch -} from '@/api/MouldManager' -import ElDragSelect from '@/components/DragSelect' -import { MouldRepairItemSelect } from '@/api/GeneralBasicData' -import arrayToTree from 'array-to-tree' - -export default { - name: 'MouldMaintainStand', - components: { - Pagination, TableColumnSettings, ElDragSelect - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - repairstandcode: '', // 鏍囧噯缂栫爜 - repairstandname: '', // 鏍囧噯鍚嶇О - repairstandescr: '', // 鐐规绠℃帶 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkcontrArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'D', name: '鏃�' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鏍囧噯鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'is_repairmould', - label: '鍏宠仈妯″叿', - id: 6, - show: true, - fixed: false, - sortable: true - }, - // { - // minWidth: false, - // width: 110, - // prop: 'is_checkeqp', - // label: '鍏宠仈璁惧', - // id: 7, - // show: true, - // fixed: false, - // sortable: true - // }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - code: '', - name: '', - description: '' - }, - operation: '', - dialogFormRules: { - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } - ] - - }, - tableDataDialog: [], // 琛ㄦ牸鏁版嵁 - - checkSelectedValue: [], - checkSelectArr: [], - - mouldDialogVisible: false, - tree: [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ], - filterText: '', - defaultProps: { - children: 'children', - label: 'name' - }, - repairstand_code: '' - - } - }, - watch: { - filterText(val) { - this.$refs.tree.filter(val) - }, - 'checkSelectedValue': { - handler: function(val) { - const arr = JSON.parse(JSON.stringify(this.tableDataDialog)) - const arrCheckcode = arr.map(i => i.code) - this.tableDataDialog = [] - val.forEach(i => { - this.tableDataDialog.push( - { - code: i, - name: this.checkSelectArr.find(j => j.code === i).name, - description: arrCheckcode.includes(i) ? arr.find(j => j.code === i).description : this.checkSelectArr.find(j => j.code === i).description - } - ) - }) - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getMouldRepairStandArdSearch().then(res => { - if (res.code === '200') { - this.getMouldRepairItemSelect() - } - }) - }, - async getMouldRepairStandArdSearch() { - const res = await MouldRepairStandArdSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldRepairStandArdSearch() - }, - // 鏌ヨ - search() { - this.getMouldRepairStandArdSearch() - }, - - // 閲嶇疆 - reset() { - this.form.repairstandcode = '' - this.form.repairstandname = '' - this.form.repairstandescr = '' - this.getMouldRepairStandArdSearch() - }, - - async getMouldRepairItemSelect() { - const { data: res } = await MouldRepairItemSelect() - this.checkSelectArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.getViewMouldRepairStanedSearch(row.code) - this.dialogVisible = true - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鍓嶈姹傛帴鍙� - async getViewMouldRepairStanedSearch(repairstand_code) { - const { data: res } = await ViewMouldRepairStanedSearch({ repairstand_code }) - this.tableDataDialog = res.data - this.checkSelectedValue = res.data.map(i => i.code) - - this.dialogForm.code = res.code - this.dialogForm.name = res.name - this.dialogForm.description = res.description - - this.tableDataDialog.forEach(item => { - item.description = item.chkdesc - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteMouldRepairStaned({ repairstand_code: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getMouldRepairStandArdSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.description = '' - this.tableDataDialog = [] - this.checkSelectedValue = [] - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - if (this.tableDataDialog.length === 0) { - return this.$message.info('淇濆吇椤逛俊鎭笉鑳戒负绌猴紒') - } - - const Data = [] - this.tableDataDialog.forEach((i, index) => { - Data.push({ - repairitem_seq: index + 1, - repairitem_code: i.code, - repairitem_name: i.name, - repairitem_descr: i.description - // cycle: '', - // isscan: '' - }) - }) - const data = { - 'code': this.dialogForm.code, - 'name': this.dialogForm.name, - 'description': this.dialogForm.description, - 'Data': Data - } - - this.$store.state.app.buttonIsDisabled = true - AddUpdateMouldRepairStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getMouldRepairStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - // 鍏宠仈妯″叿鐐瑰嚮 - async connectClick(row) { - const { data: res } = await RepairStanedAssociationMould({ repairstand_code: row.code }) - this.repairstand_code = row.code - - const keySelected = [] - res.forEach(i => { - i.parentid = '-1' - i.name = i.code + ' / ' + i.name - - if (i.flag === 'Y') { - keySelected.push(i.code) - } - }) - this.tree = arrayToTree(this.tree.concat(res), { - parentProperty: 'parentid', - customID: 'code', - childrenProperty: 'children' - }) - this.mouldDialogVisible = true - this.$nextTick(() => { - this.$refs.tree.setCheckedKeys(keySelected) - }) - }, - filterNode(value, data) { - if (!value) return true - return data.name.indexOf(value) !== -1 - }, - handleMouldClose() { - this.tree = [ - { - code: '-1', - name: '鍏ㄩ儴' - } - ] - }, - mouldDialogVisibleCancel() { - this.mouldDialogVisible = false - }, - mouldDialogVisibleConfirm() { - const treeKey = this.$refs.tree.getCheckedKeys() - const arr = [] - this.tree[0].children.forEach(i => { - // i.flag = treeKey.includes(i.code) ? 'Y' : 'N' - if (treeKey.includes(i.code)) { - arr.push({ - code: i.code, - name: i.name.split('/')[1].trim() - }) - } - }) - - this.$store.state.app.buttonIsDisabled = true - SaveRepairStanedAssociationMould(arr, this.repairstand_code).then(res => { - if (res.code === '200') { - this.$notify.success('缁戝畾鎴愬姛锛�') - this.mouldDialogVisible = false - this.getMouldRepairStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error('缁戝畾澶辫触锛�') - } - }) - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 205 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - - } -} -</script> -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=14_1')" + >瀵煎叆 + </el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.repairstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.repairstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" style=" display: flex;"> + <el-input v-model="form.repairstandescr" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + style="height:5px" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='is_repairmould'"> + <i + v-if="row[item.prop]==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + style="cursor: pointer" + @click="connectClick(row)" + /> + <i + v-if="row[item.prop]==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185);cursor:pointer;" + @click="connectClick(row)" + /> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + :style="{color:$store.state.settings.theme}" + class="el-icon-edit-outline" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldRepairStandArdSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="1100px" + :close-on-click-modal="false" + top="8vh" + @closed="handleClose" + @close="handleClose" + > + <div style="margin: 0 30px;"> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-divider content-position="left">妯″叿淇濆吇鏍囧噯淇℃伅</el-divider> + + <el-form-item label="鏍囧噯缂栫爜" prop="code"> + <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" prop="description"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + </div> + <el-divider content-position="left">鎸囧畾淇濆吇椤逛俊鎭�</el-divider> + <div style="display: flex;align-items: center"> + <!-- <div style="font-weight: bolder">鐐规椤归�夋嫨锛�</div>--> + <el-drag-select + v-model="checkSelectedValue" + style="width:940px;" + multiple + placeholder="璇烽�夋嫨鐩稿搴旀寚瀹氶」" + > + <el-option + v-for="item in checkSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-drag-select> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataDialogRef" + :data="tableDataDialog" + :height="(tableHeight-300)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-300)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + label="搴忓彿" + /> + <el-table-column + prop="code" + width="150" + label="鐐规閮ㄤ綅缂栫爜" + show-tooltip-when-overflow + /> + <el-table-column + prop="name" + label="鐐规閮ㄤ綅鍚嶇О" + width="150" + show-tooltip-when-overflow + /> + + <el-table-column + prop="description" + label="鐐规瑕佹眰" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <el-input v-model="row.description" /> + </template> + </el-table-column> + + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <el-dialog + v-el-drag-dialog + title="鍏宠仈妯″叿" + :visible.sync="mouldDialogVisible" + width="800px" + :close-on-click-modal="false" + top="8vh" + @closed="handleMouldClose" + @close="handleMouldClose" + > + <div> + <el-input + v-model="filterText" + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + /> + <el-tree + ref="tree" + class="filter-tree" + :data="tree" + :props="defaultProps" + show-checkbox + node-key="code" + style="margin-top:15px;height: 550px;overflow: auto" + default-expand-all + :filter-node-method="filterNode" + /> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="mouldDialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="mouldDialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { + AddUpdateMouldRepairStandArd, + DeleteMouldRepairStaned, + MouldRepairStandArdSearch, + RepairStanedAssociationMould, + SaveRepairStanedAssociationMould, + ViewMouldRepairStanedSearch +} from '@/api/MouldManager' +import ElDragSelect from '@/components/DragSelect' +import { MouldRepairItemSelect } from '@/api/GeneralBasicData' +import arrayToTree from 'array-to-tree' + +export default { + name: 'MouldMaintainStand', + components: { + Pagination, TableColumnSettings, ElDragSelect + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + repairstandcode: '', // 鏍囧噯缂栫爜 + repairstandname: '', // 鏍囧噯鍚嶇О + repairstandescr: '', // 鐐规绠℃帶 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkcontrArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'D', name: '鏃�' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鏍囧噯鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'is_repairmould', + label: '鍏宠仈妯″叿', + id: 6, + show: true, + fixed: false, + sortable: true + }, + // { + // minWidth: false, + // width: 110, + // prop: 'is_checkeqp', + // label: '鍏宠仈璁惧', + // id: 7, + // show: true, + // fixed: false, + // sortable: true + // }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + code: '', + name: '', + description: '' + }, + operation: '', + dialogFormRules: { + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } + ] + + }, + tableDataDialog: [], // 琛ㄦ牸鏁版嵁 + + checkSelectedValue: [], + checkSelectArr: [], + + mouldDialogVisible: false, + tree: [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ], + filterText: '', + defaultProps: { + children: 'children', + label: 'name' + }, + repairstand_code: '' + + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + }, + 'checkSelectedValue': { + handler: function(val) { + const arr = JSON.parse(JSON.stringify(this.tableDataDialog)) + const arrCheckcode = arr.map(i => i.code) + this.tableDataDialog = [] + val.forEach(i => { + this.tableDataDialog.push( + { + code: i, + name: this.checkSelectArr.find(j => j.code === i).name, + description: arrCheckcode.includes(i) ? arr.find(j => j.code === i).description : this.checkSelectArr.find(j => j.code === i).description + } + ) + }) + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getMouldRepairStandArdSearch().then(res => { + if (res.code === '200') { + this.getMouldRepairItemSelect() + } + }) + }, + async getMouldRepairStandArdSearch() { + const res = await MouldRepairStandArdSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldRepairStandArdSearch() + }, + // 鏌ヨ + search() { + this.getMouldRepairStandArdSearch() + }, + + // 閲嶇疆 + reset() { + this.form.repairstandcode = '' + this.form.repairstandname = '' + this.form.repairstandescr = '' + this.getMouldRepairStandArdSearch() + }, + + async getMouldRepairItemSelect() { + const { data: res } = await MouldRepairItemSelect() + this.checkSelectArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.getViewMouldRepairStanedSearch(row.code) + this.dialogVisible = true + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鍓嶈姹傛帴鍙� + async getViewMouldRepairStanedSearch(repairstand_code) { + const { data: res } = await ViewMouldRepairStanedSearch({ repairstand_code }) + this.tableDataDialog = res.data + this.checkSelectedValue = res.data.map(i => i.code) + + this.dialogForm.code = res.code + this.dialogForm.name = res.name + this.dialogForm.description = res.description + + this.tableDataDialog.forEach(item => { + item.description = item.chkdesc + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteMouldRepairStaned({ repairstand_code: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getMouldRepairStandArdSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.description = '' + this.tableDataDialog = [] + this.checkSelectedValue = [] + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + if (this.tableDataDialog.length === 0) { + return this.$message.info('淇濆吇椤逛俊鎭笉鑳戒负绌猴紒') + } + + const Data = [] + this.tableDataDialog.forEach((i, index) => { + Data.push({ + repairitem_seq: index + 1, + repairitem_code: i.code, + repairitem_name: i.name, + repairitem_descr: i.description + // cycle: '', + // isscan: '' + }) + }) + const data = { + 'code': this.dialogForm.code, + 'name': this.dialogForm.name, + 'description': this.dialogForm.description, + 'Data': Data + } + + this.$store.state.app.buttonIsDisabled = true + AddUpdateMouldRepairStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getMouldRepairStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + // 鍏宠仈妯″叿鐐瑰嚮 + async connectClick(row) { + const { data: res } = await RepairStanedAssociationMould({ repairstand_code: row.code }) + this.repairstand_code = row.code + + const keySelected = [] + res.forEach(i => { + i.parentid = '-1' + i.name = i.code + ' / ' + i.name + + if (i.flag === 'Y') { + keySelected.push(i.code) + } + }) + this.tree = arrayToTree(this.tree.concat(res), { + parentProperty: 'parentid', + customID: 'code', + childrenProperty: 'children' + }) + this.mouldDialogVisible = true + this.$nextTick(() => { + this.$refs.tree.setCheckedKeys(keySelected) + }) + }, + filterNode(value, data) { + if (!value) return true + return data.name.indexOf(value) !== -1 + }, + handleMouldClose() { + this.tree = [ + { + code: '-1', + name: '鍏ㄩ儴' + } + ] + }, + mouldDialogVisibleCancel() { + this.mouldDialogVisible = false + }, + mouldDialogVisibleConfirm() { + const treeKey = this.$refs.tree.getCheckedKeys() + const arr = [] + this.tree[0].children.forEach(i => { + // i.flag = treeKey.includes(i.code) ? 'Y' : 'N' + if (treeKey.includes(i.code)) { + arr.push({ + code: i.code, + name: i.name.split('/')[1].trim() + }) + } + }) + + this.$store.state.app.buttonIsDisabled = true + SaveRepairStanedAssociationMould(arr, this.repairstand_code).then(res => { + if (res.code === '200') { + this.$notify.success('缁戝畾鎴愬姛锛�') + this.mouldDialogVisible = false + this.getMouldRepairStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error('缁戝畾澶辫触锛�') + } + }) + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 205 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + + } +} +</script> +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} +</style> diff --git a/src/views/mouldManager/mouldOutInRecord.vue b/src/views/mouldManager/mouldOutInRecord.vue index 7ff5129..01ff08e 100644 --- a/src/views/mouldManager/mouldOutInRecord.vue +++ b/src/views/mouldManager/mouldOutInRecord.vue @@ -1,496 +1,501 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - - <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> - <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in typeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="浠撳簱缂栫爜" style=" display: flex;"> - <el-input v-model="form.warehousecode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="搴撲綅缂栫爜" style=" display: flex;"> - <el-input v-model="form.locationcode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> - <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - label="鎿嶄綔鏃堕棿" - > - <el-date-picker - v-model="form.operdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - - <el-table-column - prop="mould_code" - label="妯″叿缂栫爜" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_name" - label="妯″叿鍚嶇О" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_spec" - label="浜у搧瑙勬牸" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.mould_spec">{{ row.mould_spec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="type" - label="鎿嶄綔绫诲瀷" - sortable="custom" - /> - <el-table-column - prop="warehouse_code" - label="浠撳簱缂栫爜" - sortable="custom" - /> - <el-table-column - prop="warehouse_name" - label="浠撳簱鍚嶇О" - sortable="custom" - /> - - <el-table-column - prop="location_code" - label="搴撲綅缂栫爜" - sortable="custom" - /> - <el-table-column - prop="location_name" - label="搴撲綅鍚嶇О" - sortable="custom" - /> - - <el-table-column - prop="lm_user" - label="鎿嶄綔浜�" - sortable="custom" - /> - - <el-table-column - prop="lm_date" - label="鎿嶄綔鏃堕棿" - sortable="custom" - /> - - <!-- <el-table-column--> - <!-- label="鎿嶄綔"--> - <!-- width="120"--> - <!-- fixed="right"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div class="operationClass">--> - - <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> - <!-- <i--> - <!-- class="el-icon-tickets"--> - <!-- :style="{color:$store.state.settings.theme}"--> - <!-- style="cursor: pointer;margin-right: 15px"--> - <!-- @click="edit(row)"--> - <!-- />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldInOutMachinesSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - > - <template slot-scope="{row}"> - {{ row.chk_value ? row.chk_value : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - MouldCheckSubTakeSearch, - MouldCheckTakeOutExcel, - MouldInOutMachinesOutExcel, - MouldInOutMachinesSearch -} from '@/api/MouldManager' - -export default { - name: 'MouldOutInRecord', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldcode: '', - mouldname: '', - mouldspec: '', - warehousecode: '', - operuser: '', - locationcode: '', - type: '', - operdate: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - typeArr: [ - { code: 'IN', name: '鍏ュ簱' }, - { code: 'OUT', name: '鍑哄簱' } - ], - total: 10, - tableData: [], - dialogVisible: false, - tableDataDialog: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldInOutMachinesSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getMouldInOutMachinesSearch() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - warehousecode: this.form.warehousecode, - locationcode: this.form.locationcode, - type: this.form.type, - operuser: this.form.operuser, - operdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - // console.log(data, 1) - const res = await MouldInOutMachinesSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldInOutMachinesSearch() - }, - async download() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - warehousecode: this.form.warehousecode, - operuser: this.form.operuser, - locationcode: this.form.locationcode, - type: this.form.type, - operdate: tempDate - } - - const { data: res } = await MouldInOutMachinesOutExcel(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMouldInOutMachinesSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.mouldspec = '' - this.form.warehousecode = '' - this.form.locationcode = '' - this.form.type = '' - this.form.operuser = '' - this.form.operdate = '' - this.getMouldInOutMachinesSearch() - }, - - // 淇敼鎸夐挳 - async edit(row) { - this.dialogVisible = true - - const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) - this.tableDataDialog = res - - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + + <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> + <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in typeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="浠撳簱缂栫爜" style=" display: flex;"> + <el-input v-model="form.warehousecode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="搴撲綅缂栫爜" style=" display: flex;"> + <el-input v-model="form.locationcode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> + <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + label="鎿嶄綔鏃堕棿" + > + <el-date-picker + v-model="form.operdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + + <el-table-column + prop="mould_code" + label="妯″叿缂栫爜" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_name" + label="妯″叿鍚嶇О" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_spec" + label="浜у搧瑙勬牸" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.mould_spec">{{ row.mould_spec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="type" + label="鎿嶄綔绫诲瀷" + sortable="custom" + /> + <el-table-column + prop="warehouse_code" + label="浠撳簱缂栫爜" + sortable="custom" + /> + <el-table-column + prop="warehouse_name" + label="浠撳簱鍚嶇О" + sortable="custom" + /> + + <el-table-column + prop="location_code" + label="搴撲綅缂栫爜" + sortable="custom" + /> + <el-table-column + prop="location_name" + label="搴撲綅鍚嶇О" + sortable="custom" + /> + + <el-table-column + prop="lm_user" + label="鎿嶄綔浜�" + sortable="custom" + /> + + <el-table-column + prop="lm_date" + label="鎿嶄綔鏃堕棿" + sortable="custom" + /> + + <!-- <el-table-column--> + <!-- label="鎿嶄綔"--> + <!-- width="120"--> + <!-- fixed="right"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div class="operationClass">--> + + <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> + <!-- <i--> + <!-- class="el-icon-tickets"--> + <!-- :style="{color:$store.state.settings.theme}"--> + <!-- style="cursor: pointer;margin-right: 15px"--> + <!-- @click="edit(row)"--> + <!-- />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldInOutMachinesSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + > + <template slot-scope="{row}"> + {{ row.chk_value ? row.chk_value : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + MouldCheckSubTakeSearch, + MouldCheckTakeOutExcel, + MouldInOutMachinesOutExcel, + MouldInOutMachinesSearch +} from '@/api/MouldManager' + +export default { + name: 'MouldOutInRecord', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldcode: '', + mouldname: '', + mouldspec: '', + warehousecode: '', + operuser: '', + locationcode: '', + type: '', + operdate: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + typeArr: [ + { code: 'IN', name: '鍏ュ簱' }, + { code: 'OUT', name: '鍑哄簱' } + ], + total: 10, + tableData: [], + dialogVisible: false, + tableDataDialog: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldInOutMachinesSearch() + }, + created() { + this.getMouldInOutMachinesSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getMouldInOutMachinesSearch() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + warehousecode: this.form.warehousecode, + locationcode: this.form.locationcode, + type: this.form.type, + operuser: this.form.operuser, + operdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + // console.log(data, 1) + const res = await MouldInOutMachinesSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldInOutMachinesSearch() + }, + async download() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + warehousecode: this.form.warehousecode, + operuser: this.form.operuser, + locationcode: this.form.locationcode, + type: this.form.type, + operdate: tempDate + } + + const { data: res } = await MouldInOutMachinesOutExcel(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMouldInOutMachinesSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.mouldspec = '' + this.form.warehousecode = '' + this.form.locationcode = '' + this.form.type = '' + this.form.operuser = '' + this.form.operdate = '' + this.getMouldInOutMachinesSearch() + }, + + // 淇敼鎸夐挳 + async edit(row) { + this.dialogVisible = true + + const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) + this.tableDataDialog = res + + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/mouldManager/mouldRepairRecord.vue b/src/views/mouldManager/mouldRepairRecord.vue index a109f1b..a1f5cfb 100644 --- a/src/views/mouldManager/mouldRepairRecord.vue +++ b/src/views/mouldManager/mouldRepairRecord.vue @@ -1,728 +1,733 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> - <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item label="鎶ヤ慨浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缁翠慨浜哄憳" style=" display: flex;"> - <el-input v-model="form.repairuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="楠岃瘉浜哄憳" style=" display: flex;"> - <el-input v-model="form.vrifcatuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ヤ慨鏃堕棿" style=" display: flex;align-items: center"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缁翠慨鏃堕棿" style=" display: flex;align-items: center"> - <el-date-picker - v-model="form.repairdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - label="楠岃瘉鏃堕棿" - style=" display: flex;align-items: center" - > - <el-date-picker - v-model="form.vrifcatdate" - type="daterange" - :clearable="false" - class="timeMini" - range-separator="~" - start-placeholder="寮�濮嬫棩鏈�" - style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" - end-placeholder="缁撴潫鏃ユ湡" - size="mini" - /> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <!-- :key="tableTimeStampKey"--> - - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- :key="item.id"--> - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='verify_result'"> - <div v-if="row[item.prop]==='閫氳繃'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 閫氳繃 - </div> - <div v-if="row[item.prop]==='涓嶉�氳繃'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 涓嶉�氳繃 - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldUpdateSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="缁翠慨鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="7vh" - @closed="handleClose" - @close="handleClose" - > - <div style="font-size:16px;"> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿鎶ヤ慨淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px">鏁呴殰鏉ユ簮锛歿{ dialogData1.faultsource }}</div> - <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData1.faultdescr }}</div> - <div v-if="dialogData1.faultimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� - <div v-for="item in dialogData1.faultimage"> - <img - style="width: 90px;margin-right: 10px;border-radius: 10px" - :src="baseUrl+item.img1url" - alt="" - @click="handlePictureCardPreview(baseUrl+item.img1url,'妯″叿鎶ヤ慨/鏁呴殰鍥剧墖')" - > - </div> - </div> - </div> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿缁翠慨淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData2.faultdescr }}</div> - <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� - - <div v-for="item in dialogData2.repairimage" v-if="item.img1url!==''"> - <img - style="width: 90px;margin-right: 10px;border-radius: 10px" - :src="baseUrl+item.img1url" - alt="" - @click="handlePictureCardPreview(baseUrl+item.img1url,'妯″叿缁翠慨/鏁呴殰鍥剧墖')" - > - </div> - </div> - <div style="margin-bottom: 10px">鍋滄満缁翠慨锛歿{ dialogData2.isstoprepair === 'N' ? '鍚�' : '鏄�' }}</div> - <div v-if="dialogData2.repaircontent" style="margin-bottom: 10px">缁翠慨鍐呭锛歿{ dialogData2.repaircontent }}</div> - <!-- <div v-if="dialogData2.repairpart" style="margin-bottom: 10px">鏇存崲澶囦欢锛歿{ dialogData2.repairpart }}</div>--> - <!-- <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">澶囦欢鍥剧墖锛�--> - <!-- <div v-for="item in dialogData2.repairimage" v-if="item.img2url!==''">--> - <!-- <img--> - <!-- style="width: 100px;margin-right: 10px"--> - <!-- :src="baseUrl+item.img2url"--> - <!-- alt=""--> - <!-- @click="handlePictureCardPreview(baseUrl+item.img2url,'妯″叿缁翠慨/澶囦欢鍥剧墖')"--> - <!-- >--> - <!-- </div>--> - <!-- </div>--> - </div> - <div style="margin-bottom: 20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿缁翠慨楠岃瘉淇℃伅锛� - </div> - <div style="display: flex;flex-direction: column;margin-left: 40px"> - <div style="margin-bottom: 10px;display: flex;">楠岃瘉缁撴灉锛� - - <i - v-if="isResult==='閫氳繃'" - class="el-icon-success" - :style="{color:$store.state.settings.theme}" - style="margin-right: 2px" - /> - <i v-if="isResult==='涓嶉�氳繃'" class="el-icon-info" style="margin-right: 2px" /> - - {{ isResult }} - </div> - - </div> - </div> - <!-- 鍥剧墖棰勮瀵硅瘽妗�--> - <el-dialog - title="鍥剧墖棰勮" - :visible.sync="pictureVisible" - width="800px" - top="7vh" - append-to-body - @close="pictureHandleClose" - > - <div style="font-size: 16px;margin-bottom: 10px"> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> {{ pictureName }} - </div> - <div style="display: flex;justify-content: center"> - <img :key="pictureUrl" width="50%" :src="pictureUrl" alt=""> - </div> - - <el-tooltip class="item" effect="light" content="涓婁竴寮�" placement="top"> - <div - v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==0" - style="position: absolute;top: 48%;left: 3.5%;" - ><i - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;font-size: 20px" - class="el-icon-d-arrow-left" - @click="arrowLeftClick(pictureUrl,pictureName)" - /></div> - </el-tooltip> - <el-tooltip class="item" effect="light" content="涓嬩竴寮�" placement="top"> - <div - v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==pictureUrlAll.length-1" - style="position: absolute;top: 48%;right: 3.5%;" - > - <i - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;font-size: 20px" - class="el-icon-d-arrow-right" - @click="arrowRightClick(pictureUrl,pictureName)" - /></div> - </el-tooltip> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="pictureVisible=false">杩� 鍥�</el-button> - </div> - </span> - </el-dialog> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -// import { DeviceUpdateOutExcel, MouldUpdateSearch, DeviceUpdateSubSearch } from '@/api/deviceManager' -// import { ShopSearch } from '@/api/kanbanManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { MouldUpdateSearch, MouldUpdateSubSearch } from '@/api/MouldManager' - -export default { - name: 'MouldRepairRecord', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldspec: '', // 瑙勬牸鍨嬪彿 - mouldcode: '', // 妯″叿缂栫爜 - mouldname: '', // 妯″叿鍚嶇О - reportuser: '', // 鎶ヤ慨浜哄憳 - repairuser: '', // 缁翠慨浜哄憳 - vrifcatuser: '', // 楠岃瘉浜哄憳 - reportdate: '', // 鎶ヤ慨鏃堕棿 - repairdate: '', // 缁翠慨鏃堕棿 - vrifcatdate: '', // 楠岃瘉鏃堕棿 - prop: 'repair_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopSelectArr: [], - total: 10, - tableData: [], - - tableColumnSettingsArray: [ - // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'repair_code', - label: '缁翠慨鍗曞彿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - - { - minWidth: false, - width: 110, - prop: 'mould_code', - label: '妯″叿缂栫爜', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'mould_name', - label: '妯″叿鍚嶇О', - id: 5, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'mould_spec', - label: '瑙勬牸鍨嬪彿', - id: 6, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'request_person', - label: '鎶ヤ慨浜�', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 160, - prop: 'request_date', - label: '淇濅慨鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'repair_person', - label: '缁翠慨浜�', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 160, - prop: 'repair_date', - label: '缁翠慨瀹屾垚鏃堕棿', - id: 11, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'cycleDate', - label: '缁翠慨鏃堕暱', - id: 12, - show: true, - fixed: false, - sortable: true - }, { - minWidth: false, - width: 110, - prop: 'verify_person', - label: '楠岃瘉浜�', - id: 13, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'verify_date', - label: '楠岃瘉鏃堕棿', - id: 14, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'verify_result', - label: '楠岃瘉缁撴灉', - id: 15, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogData1: {}, - dialogData2: {}, - isResult: '', // 楠岃瘉缁撴灉 - operation: '', - - baseUrl: '', // 鍥剧墖棰勮鍦板潃鍓嶇紑 - - pictureVisible: false, // 鍥剧墖棰勮瀵硅瘽妗� - pictureUrl: '', // 鍥剧墖棰勮Url - pictureName: '', // 鍥剧墖棰勮鍚嶇О - pictureUrlAll: [], // 鍥剧墖棰勮鍦板潃鐨勬墍鏈塙rl - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldUpdateSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.baseUrl = process.env.VUE_APP_BASE_API_FILE - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - - async getMouldUpdateSearch() { - let reportdate = this.form.reportdate - if (reportdate.length > 0) { - reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) - } - let repairdate = this.form.repairdate - if (repairdate.length > 0) { - repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) - } - let vrifcatdate = this.form.vrifcatdate - if (vrifcatdate.length > 0) { - vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) - } - const data = { - mouldspec: this.form.mouldspec, // 瑙勬牸鍨嬪彿 - mouldcode: this.form.mouldcode, // 妯″叿缂栫爜 - mouldname: this.form.mouldname, // 妯″叿鍚嶇О - reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 - repairuser: this.form.repairuser, // 缁翠慨浜哄憳 - vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 - reportdate, // 鎶ヤ慨鏃堕棿 - repairdate, // 缁翠慨鏃堕棿 - vrifcatdate, // 楠岃瘉鏃堕棿 - prop: 'repair_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - } - - const res = await MouldUpdateSearch(data) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldUpdateSearch() - }, - // 鏌ヨ - search() { - this.getMouldUpdateSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldspec = '' - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.reportuser = '' - this.form.repairuser = '' - this.form.vrifcatuser = '' - this.form.reportdate = '' - this.form.repairdate = '' - this.form.vrifcatdate = '' - this.getMouldUpdateSearch() - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const { data: res } = await MouldUpdateSubSearch({ repair_code: row.repair_code }) - this.dialogData1 = res.data1 - this.dialogData2 = res.data2 - this.isResult = row.verify_result - - // 妯″叿鎶ヤ慨鍥剧墖闆嗗悎 - if (this.dialogData1.faultimage) { - this.dialogData1.faultimage.forEach(item => { - this.pictureUrlAll.push( - { url: this.baseUrl + item.img1url, name: '妯″叿鎶ヤ慨/鏁呴殰鍥剧墖' } - ) - }) - } - // 妯″叿缁翠慨鍥剧墖闆嗗悎 - if (this.dialogData2.repairimage) { - this.dialogData2.repairimage.forEach(item => { - this.pictureUrlAll.push( - { - url: item.img1url ? this.baseUrl + item.img1url : this.baseUrl + item.img2url, - name: item.img1url ? '妯″叿缁翠慨/鏁呴殰鍥剧墖' : '妯″叿缁翠慨/澶囦欢鍥剧墖' - } - ) - }) - } - }, - handlePictureCardPreview(url, name) { - this.pictureVisible = true - this.pictureUrl = url - this.pictureName = name - }, - arrowLeftClick(pictureUrl, pictureName) { - this.pictureUrlAll.forEach((item, index) => { - if (item.url === pictureUrl) { - this.pictureUrl = this.pictureUrlAll[index - 1].url - this.pictureName = this.pictureUrlAll[index - 1].name - } - }) - }, - arrowRightClick(pictureUrl, pictureName) { - this.pictureUrlAll.forEach((item, index) => { - if (item.url === pictureUrl) { - this.pictureUrl = this.pictureUrlAll[index + 1].url - this.pictureName = this.pictureUrlAll[index + 1].name - } - }) - }, - pictureHandleClose() { - this.pictureUrl = '' - this.pictureName = '' - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogData1 = {} - this.dialogData2 = {} - this.isResult = '' - this.pictureUrlAll = [] - }, - async download() { - let reportdate = this.form.reportdate - if (reportdate.length > 0) { - reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) - } - let repairdate = this.form.repairdate - if (repairdate.length > 0) { - repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) - } - let vrifcatdate = this.form.vrifcatdate - if (vrifcatdate.length > 0) { - vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) - } - const data = { - mouldspec: this.form.mouldspec, // 瑙勬牸鍨嬪彿 - mouldcode: this.form.mouldcode, // 妯″叿缂栫爜 - mouldname: this.form.mouldname, // 妯″叿鍚嶇О - reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 - repairuser: this.form.repairuser, // 缁翠慨浜哄憳 - vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 - reportdate, // 鎶ヤ慨鏃堕棿 - repairdate, // 缁翠慨鏃堕棿 - vrifcatdate // 楠岃瘉鏃堕棿 - } - const { data: res } = await DeviceUpdateOutExcel(data) - window.location.href = res - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 295 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> + <el-input v-model="form.mouldspec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item label="鎶ヤ慨浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缁翠慨浜哄憳" style=" display: flex;"> + <el-input v-model="form.repairuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="楠岃瘉浜哄憳" style=" display: flex;"> + <el-input v-model="form.vrifcatuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ヤ慨鏃堕棿" style=" display: flex;align-items: center"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缁翠慨鏃堕棿" style=" display: flex;align-items: center"> + <el-date-picker + v-model="form.repairdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + label="楠岃瘉鏃堕棿" + style=" display: flex;align-items: center" + > + <el-date-picker + v-model="form.vrifcatdate" + type="daterange" + :clearable="false" + class="timeMini" + range-separator="~" + start-placeholder="寮�濮嬫棩鏈�" + style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" + end-placeholder="缁撴潫鏃ユ湡" + size="mini" + /> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <!-- :key="tableTimeStampKey"--> + + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- :key="item.id"--> + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='verify_result'"> + <div v-if="row[item.prop]==='閫氳繃'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 閫氳繃 + </div> + <div v-if="row[item.prop]==='涓嶉�氳繃'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 涓嶉�氳繃 + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldUpdateSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="缁翠慨鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="7vh" + @closed="handleClose" + @close="handleClose" + > + <div style="font-size:16px;"> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿鎶ヤ慨淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px">鏁呴殰鏉ユ簮锛歿{ dialogData1.faultsource }}</div> + <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData1.faultdescr }}</div> + <div v-if="dialogData1.faultimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� + <div v-for="item in dialogData1.faultimage"> + <img + style="width: 90px;margin-right: 10px;border-radius: 10px" + :src="baseUrl+item.img1url" + alt="" + @click="handlePictureCardPreview(baseUrl+item.img1url,'妯″叿鎶ヤ慨/鏁呴殰鍥剧墖')" + > + </div> + </div> + </div> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿缁翠慨淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px">鏁呴殰鎻忚堪锛歿{ dialogData2.faultdescr }}</div> + <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">鏁呴殰鍥剧墖锛� + + <div v-for="item in dialogData2.repairimage" v-if="item.img1url!==''"> + <img + style="width: 90px;margin-right: 10px;border-radius: 10px" + :src="baseUrl+item.img1url" + alt="" + @click="handlePictureCardPreview(baseUrl+item.img1url,'妯″叿缁翠慨/鏁呴殰鍥剧墖')" + > + </div> + </div> + <div style="margin-bottom: 10px">鍋滄満缁翠慨锛歿{ dialogData2.isstoprepair === 'N' ? '鍚�' : '鏄�' }}</div> + <div v-if="dialogData2.repaircontent" style="margin-bottom: 10px">缁翠慨鍐呭锛歿{ dialogData2.repaircontent }}</div> + <!-- <div v-if="dialogData2.repairpart" style="margin-bottom: 10px">鏇存崲澶囦欢锛歿{ dialogData2.repairpart }}</div>--> + <!-- <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">澶囦欢鍥剧墖锛�--> + <!-- <div v-for="item in dialogData2.repairimage" v-if="item.img2url!==''">--> + <!-- <img--> + <!-- style="width: 100px;margin-right: 10px"--> + <!-- :src="baseUrl+item.img2url"--> + <!-- alt=""--> + <!-- @click="handlePictureCardPreview(baseUrl+item.img2url,'妯″叿缁翠慨/澶囦欢鍥剧墖')"--> + <!-- >--> + <!-- </div>--> + <!-- </div>--> + </div> + <div style="margin-bottom: 20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 妯″叿缁翠慨楠岃瘉淇℃伅锛� + </div> + <div style="display: flex;flex-direction: column;margin-left: 40px"> + <div style="margin-bottom: 10px;display: flex;">楠岃瘉缁撴灉锛� + + <i + v-if="isResult==='閫氳繃'" + class="el-icon-success" + :style="{color:$store.state.settings.theme}" + style="margin-right: 2px" + /> + <i v-if="isResult==='涓嶉�氳繃'" class="el-icon-info" style="margin-right: 2px" /> + + {{ isResult }} + </div> + + </div> + </div> + <!-- 鍥剧墖棰勮瀵硅瘽妗�--> + <el-dialog + title="鍥剧墖棰勮" + :visible.sync="pictureVisible" + width="800px" + top="7vh" + append-to-body + @close="pictureHandleClose" + > + <div style="font-size: 16px;margin-bottom: 10px"> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> {{ pictureName }} + </div> + <div style="display: flex;justify-content: center"> + <img :key="pictureUrl" width="50%" :src="pictureUrl" alt=""> + </div> + + <el-tooltip class="item" effect="light" content="涓婁竴寮�" placement="top"> + <div + v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==0" + style="position: absolute;top: 48%;left: 3.5%;" + ><i + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;font-size: 20px" + class="el-icon-d-arrow-left" + @click="arrowLeftClick(pictureUrl,pictureName)" + /></div> + </el-tooltip> + <el-tooltip class="item" effect="light" content="涓嬩竴寮�" placement="top"> + <div + v-if="pictureUrlAll.findIndex(item => item.url === pictureUrl)!==pictureUrlAll.length-1" + style="position: absolute;top: 48%;right: 3.5%;" + > + <i + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;font-size: 20px" + class="el-icon-d-arrow-right" + @click="arrowRightClick(pictureUrl,pictureName)" + /></div> + </el-tooltip> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="pictureVisible=false">杩� 鍥�</el-button> + </div> + </span> + </el-dialog> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +// import { DeviceUpdateOutExcel, MouldUpdateSearch, DeviceUpdateSubSearch } from '@/api/deviceManager' +// import { ShopSearch } from '@/api/kanbanManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { MouldUpdateSearch, MouldUpdateSubSearch } from '@/api/MouldManager' + +export default { + name: 'MouldRepairRecord', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldspec: '', // 瑙勬牸鍨嬪彿 + mouldcode: '', // 妯″叿缂栫爜 + mouldname: '', // 妯″叿鍚嶇О + reportuser: '', // 鎶ヤ慨浜哄憳 + repairuser: '', // 缁翠慨浜哄憳 + vrifcatuser: '', // 楠岃瘉浜哄憳 + reportdate: '', // 鎶ヤ慨鏃堕棿 + repairdate: '', // 缁翠慨鏃堕棿 + vrifcatdate: '', // 楠岃瘉鏃堕棿 + prop: 'repair_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopSelectArr: [], + total: 10, + tableData: [], + + tableColumnSettingsArray: [ + // { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'repair_code', + label: '缁翠慨鍗曞彿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + + { + minWidth: false, + width: 110, + prop: 'mould_code', + label: '妯″叿缂栫爜', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'mould_name', + label: '妯″叿鍚嶇О', + id: 5, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'mould_spec', + label: '瑙勬牸鍨嬪彿', + id: 6, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'request_person', + label: '鎶ヤ慨浜�', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 160, + prop: 'request_date', + label: '淇濅慨鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'repair_person', + label: '缁翠慨浜�', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 160, + prop: 'repair_date', + label: '缁翠慨瀹屾垚鏃堕棿', + id: 11, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'cycleDate', + label: '缁翠慨鏃堕暱', + id: 12, + show: true, + fixed: false, + sortable: true + }, { + minWidth: false, + width: 110, + prop: 'verify_person', + label: '楠岃瘉浜�', + id: 13, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'verify_date', + label: '楠岃瘉鏃堕棿', + id: 14, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'verify_result', + label: '楠岃瘉缁撴灉', + id: 15, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogData1: {}, + dialogData2: {}, + isResult: '', // 楠岃瘉缁撴灉 + operation: '', + + baseUrl: '', // 鍥剧墖棰勮鍦板潃鍓嶇紑 + + pictureVisible: false, // 鍥剧墖棰勮瀵硅瘽妗� + pictureUrl: '', // 鍥剧墖棰勮Url + pictureName: '', // 鍥剧墖棰勮鍚嶇О + pictureUrlAll: [], // 鍥剧墖棰勮鍦板潃鐨勬墍鏈塙rl + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldUpdateSearch() + }, + created() { + this.getMouldUpdateSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.baseUrl = process.env.VUE_APP_BASE_API_FILE + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + + async getMouldUpdateSearch() { + let reportdate = this.form.reportdate + if (reportdate.length > 0) { + reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) + } + let repairdate = this.form.repairdate + if (repairdate.length > 0) { + repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) + } + let vrifcatdate = this.form.vrifcatdate + if (vrifcatdate.length > 0) { + vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) + } + const data = { + mouldspec: this.form.mouldspec, // 瑙勬牸鍨嬪彿 + mouldcode: this.form.mouldcode, // 妯″叿缂栫爜 + mouldname: this.form.mouldname, // 妯″叿鍚嶇О + reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 + repairuser: this.form.repairuser, // 缁翠慨浜哄憳 + vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 + reportdate, // 鎶ヤ慨鏃堕棿 + repairdate, // 缁翠慨鏃堕棿 + vrifcatdate, // 楠岃瘉鏃堕棿 + prop: 'repair_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + } + + const res = await MouldUpdateSearch(data) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldUpdateSearch() + }, + // 鏌ヨ + search() { + this.getMouldUpdateSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldspec = '' + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.reportuser = '' + this.form.repairuser = '' + this.form.vrifcatuser = '' + this.form.reportdate = '' + this.form.repairdate = '' + this.form.vrifcatdate = '' + this.getMouldUpdateSearch() + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const { data: res } = await MouldUpdateSubSearch({ repair_code: row.repair_code }) + this.dialogData1 = res.data1 + this.dialogData2 = res.data2 + this.isResult = row.verify_result + + // 妯″叿鎶ヤ慨鍥剧墖闆嗗悎 + if (this.dialogData1.faultimage) { + this.dialogData1.faultimage.forEach(item => { + this.pictureUrlAll.push( + { url: this.baseUrl + item.img1url, name: '妯″叿鎶ヤ慨/鏁呴殰鍥剧墖' } + ) + }) + } + // 妯″叿缁翠慨鍥剧墖闆嗗悎 + if (this.dialogData2.repairimage) { + this.dialogData2.repairimage.forEach(item => { + this.pictureUrlAll.push( + { + url: item.img1url ? this.baseUrl + item.img1url : this.baseUrl + item.img2url, + name: item.img1url ? '妯″叿缁翠慨/鏁呴殰鍥剧墖' : '妯″叿缁翠慨/澶囦欢鍥剧墖' + } + ) + }) + } + }, + handlePictureCardPreview(url, name) { + this.pictureVisible = true + this.pictureUrl = url + this.pictureName = name + }, + arrowLeftClick(pictureUrl, pictureName) { + this.pictureUrlAll.forEach((item, index) => { + if (item.url === pictureUrl) { + this.pictureUrl = this.pictureUrlAll[index - 1].url + this.pictureName = this.pictureUrlAll[index - 1].name + } + }) + }, + arrowRightClick(pictureUrl, pictureName) { + this.pictureUrlAll.forEach((item, index) => { + if (item.url === pictureUrl) { + this.pictureUrl = this.pictureUrlAll[index + 1].url + this.pictureName = this.pictureUrlAll[index + 1].name + } + }) + }, + pictureHandleClose() { + this.pictureUrl = '' + this.pictureName = '' + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogData1 = {} + this.dialogData2 = {} + this.isResult = '' + this.pictureUrlAll = [] + }, + async download() { + let reportdate = this.form.reportdate + if (reportdate.length > 0) { + reportdate = handleDatetime(reportdate[0]) + '~' + handleDatetime(reportdate[1]) + } + let repairdate = this.form.repairdate + if (repairdate.length > 0) { + repairdate = handleDatetime(repairdate[0]) + '~' + handleDatetime(repairdate[1]) + } + let vrifcatdate = this.form.vrifcatdate + if (vrifcatdate.length > 0) { + vrifcatdate = handleDatetime(vrifcatdate[0]) + '~' + handleDatetime(vrifcatdate[1]) + } + const data = { + mouldspec: this.form.mouldspec, // 瑙勬牸鍨嬪彿 + mouldcode: this.form.mouldcode, // 妯″叿缂栫爜 + mouldname: this.form.mouldname, // 妯″叿鍚嶇О + reportuser: this.form.reportuser, // 鎶ヤ慨浜哄憳 + repairuser: this.form.repairuser, // 缁翠慨浜哄憳 + vrifcatuser: this.form.vrifcatuser, // 楠岃瘉浜哄憳 + reportdate, // 鎶ヤ慨鏃堕棿 + repairdate, // 缁翠慨鏃堕棿 + vrifcatdate // 楠岃瘉鏃堕棿 + } + const { data: res } = await DeviceUpdateOutExcel(data) + window.location.href = res + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 295 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/mouldManager/mouldUpDownRecord.vue b/src/views/mouldManager/mouldUpDownRecord.vue index 6b24a26..f12cea3 100644 --- a/src/views/mouldManager/mouldUpDownRecord.vue +++ b/src/views/mouldManager/mouldUpDownRecord.vue @@ -1,500 +1,505 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> - <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> - <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - - <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> - <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in typeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.devicecode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> - <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - label="鎿嶄綔鏃堕棿" - > - <el-date-picker - v-model="form.operdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - - <el-table-column - prop="mould_code" - label="妯″叿缂栫爜" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_name" - label="妯″叿鍚嶇О" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="mould_spec" - label="浜у搧瑙勬牸" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.mould_spec">{{ row.mould_spec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="type" - label="鎿嶄綔绫诲瀷" - sortable="custom" - /> - <el-table-column - prop="usecount_life" - label="鍓╀綑瀵垮懡" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.usecount_life?row.usecount_life:'/' }} - </template> - </el-table-column> - <el-table-column - prop="eqp_code" - label="璁惧缂栫爜" - sortable="custom" - /> - <el-table-column - prop="eqp_name" - label="璁惧鍚嶇О" - sortable="custom" - /> - - <el-table-column - prop="lm_user" - label="鎿嶄綔浜�" - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="chk_result"--> - <!-- label="鐐规缁撴灉"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <el-tag v-if="row.chk_result==='OK'" size="small" type="success">鍚堟牸</el-tag>--> - <!-- <el-tag v-if="row.chk_result==='NG'" size="small" type="danger">寮傚父</el-tag>--> - <!-- </template>--> - <!-- </el-table-column>--> - - <el-table-column - prop="lm_date" - label="鎿嶄綔鏃堕棿" - sortable="custom" - /> - - <!-- <el-table-column--> - <!-- label="鎿嶄綔"--> - <!-- width="120"--> - <!-- fixed="right"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div class="operationClass">--> - - <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> - <!-- <i--> - <!-- class="el-icon-tickets"--> - <!-- :style="{color:$store.state.settings.theme}"--> - <!-- style="cursor: pointer;margin-right: 15px"--> - <!-- @click="edit(row)"--> - <!-- />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMouldUpDownMachinesSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏄庣粏" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv" style="margin-top: 0"> - <el-table - :data="tableDataDialog" - :height="500+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:500+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="seq" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="itemcode" - label="閮ㄤ綅缂栫爜" - /> - <el-table-column - prop="itemname" - label="閮ㄤ綅鍚嶇О" - /> - <el-table-column - prop="result" - label="鐐规缁撴灉" - > - <template slot-scope="{row}"> - <div v-if="row.result==='OK'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 姝e父 - </div> - <div v-if="row.result==='NG'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寮傚父 - </div> - </template> - </el-table-column> - <el-table-column - prop="chk_value" - label="鏁板��" - > - <template slot-scope="{row}"> - {{ row.chk_value ? row.chk_value : '/' }} - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="remark"--> - <!-- label="澶囨敞"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - </el-table> - </div> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - MouldCheckSubTakeSearch, - MouldCheckTakeOutExcel, - MouldUpDownMachinesOutExcel, - MouldUpDownMachinesSearch -} from '@/api/MouldManager' - -export default { - name: 'MouldUpDownRecord', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - mouldcode: '', - mouldname: '', - mouldspec: '', - devicecode: '', - stanedname: '', - operuser: '', - type: '', - operdate: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - typeArr: [ - { code: 'UP', name: '涓婃満' }, - { code: 'DOWN', name: '涓嬫満' } - ], - total: 10, - tableData: [], - dialogVisible: false, - tableDataDialog: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getMouldUpDownMachinesSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getMouldUpDownMachinesSearch() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - devicecode: this.form.devicecode, - operuser: this.form.operuser, - type: this.form.type, - operdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - console.log(data, 1) - const res = await MouldUpDownMachinesSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMouldUpDownMachinesSearch() - }, - async download() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - mouldcode: this.form.mouldcode, - mouldname: this.form.mouldname, - mouldspec: this.form.mouldspec, - devicecode: this.form.devicecode, - stanedname: this.form.stanedname, - operuser: this.form.operuser, - type: this.form.type, - operdate: tempDate - } - - const { data: res } = await MouldUpDownMachinesOutExcel(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMouldUpDownMachinesSearch() - }, - - // 閲嶇疆 - reset() { - this.form.mouldcode = '' - this.form.mouldname = '' - this.form.mouldspec = '' - this.form.devicecode = '' - this.form.operuser = '' - this.form.type = '' - this.form.operdate = '' - this.getMouldUpDownMachinesSearch() - }, - - // 淇敼鎸夐挳 - async edit(row) { - this.dialogVisible = true - - const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) - this.tableDataDialog = res - - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="妯″叿缂栫爜" style=" display: flex;"> + <el-input v-model="form.mouldcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="妯″叿鍚嶇О" style=" display: flex;"> + <el-input v-model="form.mouldname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.mouldspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + + <el-form-item label="鎿嶄綔绫诲瀷" style=" display: flex;"> + <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in typeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.devicecode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;"> + <el-input v-model="form.operuser" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + label="鎿嶄綔鏃堕棿" + > + <el-date-picker + v-model="form.operdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + + <el-table-column + prop="mould_code" + label="妯″叿缂栫爜" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_name" + label="妯″叿鍚嶇О" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="mould_spec" + label="浜у搧瑙勬牸" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.mould_spec">{{ row.mould_spec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="type" + label="鎿嶄綔绫诲瀷" + sortable="custom" + /> + <el-table-column + prop="usecount_life" + label="鍓╀綑瀵垮懡" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.usecount_life?row.usecount_life:'/' }} + </template> + </el-table-column> + <el-table-column + prop="eqp_code" + label="璁惧缂栫爜" + sortable="custom" + /> + <el-table-column + prop="eqp_name" + label="璁惧鍚嶇О" + sortable="custom" + /> + + <el-table-column + prop="lm_user" + label="鎿嶄綔浜�" + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="chk_result"--> + <!-- label="鐐规缁撴灉"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <el-tag v-if="row.chk_result==='OK'" size="small" type="success">鍚堟牸</el-tag>--> + <!-- <el-tag v-if="row.chk_result==='NG'" size="small" type="danger">寮傚父</el-tag>--> + <!-- </template>--> + <!-- </el-table-column>--> + + <el-table-column + prop="lm_date" + label="鎿嶄綔鏃堕棿" + sortable="custom" + /> + + <!-- <el-table-column--> + <!-- label="鎿嶄綔"--> + <!-- width="120"--> + <!-- fixed="right"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div class="operationClass">--> + + <!-- <el-tooltip class="item" effect="dark" content="鏄庣粏" placement="top">--> + <!-- <i--> + <!-- class="el-icon-tickets"--> + <!-- :style="{color:$store.state.settings.theme}"--> + <!-- style="cursor: pointer;margin-right: 15px"--> + <!-- @click="edit(row)"--> + <!-- />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMouldUpDownMachinesSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏄庣粏" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv" style="margin-top: 0"> + <el-table + :data="tableDataDialog" + :height="500+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:500+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="seq" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="itemcode" + label="閮ㄤ綅缂栫爜" + /> + <el-table-column + prop="itemname" + label="閮ㄤ綅鍚嶇О" + /> + <el-table-column + prop="result" + label="鐐规缁撴灉" + > + <template slot-scope="{row}"> + <div v-if="row.result==='OK'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 姝e父 + </div> + <div v-if="row.result==='NG'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寮傚父 + </div> + </template> + </el-table-column> + <el-table-column + prop="chk_value" + label="鏁板��" + > + <template slot-scope="{row}"> + {{ row.chk_value ? row.chk_value : '/' }} + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="remark"--> + <!-- label="澶囨敞"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + </el-table> + </div> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + MouldCheckSubTakeSearch, + MouldCheckTakeOutExcel, + MouldUpDownMachinesOutExcel, + MouldUpDownMachinesSearch +} from '@/api/MouldManager' + +export default { + name: 'MouldUpDownRecord', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + mouldcode: '', + mouldname: '', + mouldspec: '', + devicecode: '', + stanedname: '', + operuser: '', + type: '', + operdate: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + typeArr: [ + { code: 'UP', name: '涓婃満' }, + { code: 'DOWN', name: '涓嬫満' } + ], + total: 10, + tableData: [], + dialogVisible: false, + tableDataDialog: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMouldUpDownMachinesSearch() + }, + created() { + this.getMouldUpDownMachinesSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getMouldUpDownMachinesSearch() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + devicecode: this.form.devicecode, + operuser: this.form.operuser, + type: this.form.type, + operdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + console.log(data, 1) + const res = await MouldUpDownMachinesSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMouldUpDownMachinesSearch() + }, + async download() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + mouldcode: this.form.mouldcode, + mouldname: this.form.mouldname, + mouldspec: this.form.mouldspec, + devicecode: this.form.devicecode, + stanedname: this.form.stanedname, + operuser: this.form.operuser, + type: this.form.type, + operdate: tempDate + } + + const { data: res } = await MouldUpDownMachinesOutExcel(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMouldUpDownMachinesSearch() + }, + + // 閲嶇疆 + reset() { + this.form.mouldcode = '' + this.form.mouldname = '' + this.form.mouldspec = '' + this.form.devicecode = '' + this.form.operuser = '' + this.form.type = '' + this.form.operdate = '' + this.getMouldUpDownMachinesSearch() + }, + + // 淇敼鎸夐挳 + async edit(row) { + this.dialogVisible = true + + const { data: res } = await MouldCheckSubTakeSearch({ id: row.id }) + this.tableDataDialog = res + + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/produce/reportCorrect.vue b/src/views/produce/reportCorrect.vue index aec8a5c..d670b72 100644 --- a/src/views/produce/reportCorrect.vue +++ b/src/views/produce/reportCorrect.vue @@ -1,777 +1,785 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div class="bodyTopFormGroup" style="margin-top: 10px;"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栫爜" style=" display: flex;"> - <el-input v-model="form.wo_code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partnumber" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧瑙勬牸" style=" display: flex;"> - <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style=" display: flex;"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getMesOrderStepVerifySearch">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- <el-table-column--> - <!-- type="selection"--> - <!-- width="50"--> - <!-- :reserve-selection="true"--> - <!-- fixed--> - <!-- />--> - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="鎶ュ伐宸ュ崟" - sortable="custom" - min-width="160" - show-overflow-tooltip - /> - <el-table-column - prop="partnumber" - label="浜у搧缂栫爜" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <!-- <el-table-column--> - <!-- prop="wkshp_name"--> - <!-- label="杞﹂棿鍚嶇О"--> - <!-- show-overflow-tooltip--> - <!-- sortable="custom"--> - <!-- min-width="110"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="eqp_name"--> - <!-- label="璁惧鍚嶇О"--> - <!-- sortable="custom"--> - <!-- show-overflow-tooltip--> - <!-- min-width="110"--> - <!-- />--> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <!-- <el-table-column--> - <!-- prop="step_price"--> - <!-- label="宸ュ簭鍗曚环"--> - <!-- show-overflow-tooltip--> - <!-- sortable="custom"--> - <!-- min-width="110"--> - <!-- />--> - <el-table-column - prop="steptype" - label="宸ュ簭绫诲瀷" - show-overflow-tooltip - sortable="custom" - min-width="110" - > - <template slot-scope="{row}"> - {{ row.steptype === 'Z' ? '鑷埗' : '澶栧崗' }} - </template> - </el-table-column> - <el-table-column - prop="wx_name" - label="渚涘簲鍟�" - show-overflow-tooltip - sortable="custom" - min-width="110" - > - <template slot-scope="{row}"> - {{ row.wx_name ? row.wx_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="usergroup_name" - label="鎶ュ伐鐝粍" - show-overflow-tooltip - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.usergroup_name ? row.usergroup_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="username" - label="鎶ュ伐浜哄憳" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="report_qty" - label="鍚堟牸鏁伴噺" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <el-table-column - prop="ng_qty" - label="涓嶈壇鏁伴噺" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="laborbad_qty" - label="宸ュ簾鏁伴噺" - min-width="110" - show-overflow-tooltip - sortable="custom" - /> - <el-table-column - prop="materielbad_qty" - label="鏂欏簾鏁伴噺" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎶ュ伐鏃堕棿" - min-width="160" - show-overflow-tooltip - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="100" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button - type="text" - style="cursor: pointer;font-size: 14px" - @click="reportAdjust(row)" - >鎶ュ伐璋冩暣 - </el-button> - - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getMesOrderStepVerifySearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鎶ュ伐璋冩暣" - :visible.sync="dialogVisible" - width="1080px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-divider content-position="left">宸ュ崟淇℃伅</el-divider> - - <el-form-item label="宸ュ崟缂栧彿" class="dialogFormItem"> - <div style="width: 200px;"> - {{ dialogForm.wo_code }} - </div> - <!-- <el-input v-model="dialogForm.postcode" style="width: 200px" />--> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" class="dialogFormItem"> - <div style="width: 200px;"> - {{ dialogForm.partnumber }} - </div> - <!-- <el-input v-model="dialogForm.postname" style="width: 200px" />--> - </el-form-item> - <el-form-item label="浜у搧鍚嶇О" class="dialogFormItem"> - <div style="width: 200px;"> - {{ dialogForm.partname }} - </div> - </el-form-item> - <el-form-item label="浜у搧瑙勬牸" class="dialogFormItem"> - <div style="width: 200px;"> - {{ dialogForm.partspec ? dialogForm.partspec : '/' }} - </div> - </el-form-item> - <el-form-item label="鐢熶骇宸ュ簭" class="dialogFormItem"> - <div style="width: 200px;"> - {{ dialogForm.step_name }} - </div> - </el-form-item> - <el-form-item label="宸ュ簭鍗曚环" class="dialogFormItem"> - <!-- <div style="width: 200px;">--> - <!-- {{ dialogForm.unprice ? dialogForm.unprice : '/' }}--> - <!-- </div>--> - <el-input - v-model="dialogForm.unprice" - oninput="value=value.replace(/[^0-9.]/g,'')" - style="width: 200px" - /> - </el-form-item> - <el-form-item v-if="dialogForm.flw_type==='Z'" label="鎶ュ伐鐝粍" class="dialogFormItem"> - <div style="width: 200px;" class="ellipsis"> - {{ dialogForm.usergroup_name ? dialogForm.usergroup_name : '/' }} - </div> - </el-form-item> - <el-form-item v-if="dialogForm.flw_type!=='Z'" label="渚涘簲鍟�" class="dialogFormItem"> - <div style="width: 200px;" class="ellipsis"> - {{ dialogForm.wx_name }} - </div> - </el-form-item> - <el-form-item label="鎶ュ伐浜哄憳" class="dialogFormItem"> - <div style="width: 200px;" class="ellipsis"> - {{ dialogForm.username }} - </div> - </el-form-item> - <el-form-item :label="dialogForm.flw_type==='Z'?'鍚堟牸鏁伴噺':'鏀舵枡鏁伴噺'" prop="report_qty" class="dialogFormItem"> - <el-input - v-model="dialogForm.report_qty" - oninput="value=value.replace(/[^0-9]/g,'')" - style="width: 200px" - /> - </el-form-item> - - <el-divider content-position="left">鎶ュ伐鎯呭喌</el-divider> - - <el-table - ref="tableDataDialogRef" - key="tableDataDialogKey" - :data="tableDataDialog" - border - row-class-name="custom-row" - height="200" - style="width: 100%;margin-top: 15px;" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - label="搴忓彿" - align="center" - width="50" - /> - <el-table-column - prop="stepcode" - show-tooltip-when-overflow - label="缂洪櫡缂栫爜/鍚嶇О" - align="center" - min-width="400" - > - <template slot-scope="{row}"> - <el-select - v-model="row.defect_code" - style="width: 100%" - placeholder="璇烽�夋嫨" - multiple - filterable - > - <!-- collapse-tags--> - <el-option - v-for="item in defectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - - <el-table-column - prop="defect_qty" - label="涓嶈壇鏁伴噺" - align="center" - > - <template slot-scope="{row}"> - <el-input - v-model="row.defect_qty" - placeholder="璇疯緭鍏ユ暟閲�" - oninput="value=value.replace(/[^0-9]/g,'')" - style="width: 100%" - /> - </template> - </el-table-column> - <el-table-column - prop="laborbad_qty" - label="宸ュ簾鏁伴噺" - align="center" - > - <template slot-scope="{row}"> - <el-input - v-model="row.laborbad_qty" - placeholder="璇疯緭鍏ユ暟閲�" - oninput="value=value.replace(/[^0-9]/g,'')" - style="width: 100%" - /> - </template> - </el-table-column> - <el-table-column - prop="materielbad_qty" - label="鏂欏簾鏁伴噺" - align="center" - > - <template slot-scope="{row}"> - <el-input - v-model="row.materielbad_qty" - placeholder="璇疯緭鍏ユ暟閲�" - oninput="value=value.replace(/[^0-9]/g,'')" - style="width: 100%" - /> - </template> - </el-table-column> - </el-table> - - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { DefectPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData' -import { MesOrderStepModelSearch, MesOrderStepUpdateSeave, MesOrderStepVerifySearch } from '@/api/WorkOrder' - -export default { - name: 'ReportCorrect', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', - wo_code: '', // 宸ュ崟缂栫爜 - partnumber: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 浜у搧瑙勬牸 - reportuser: '', // 鎶ュ伐浜哄憳 - reportdate: '', // 鎶ュ伐鏃堕棿 - - prop: 'report_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - wkshopcodeArr: [], - dialogVisible: false, - dialogForm: { - 'id': '', - 'sbid': '', - 'wo_code': '', - 'partnumber': '', - partname: '', - partspec: '', - usergroup_name: '', - username: '', - 'task_qty': '', - 'wkshp_code': '', - 'eqp_code': '', - 'step_seq': '', - 'step_code': '', - 'step_name': '', - 'flw_type': '', - 'first_choke': '', - 'last_choke': '', - 'unprice': '', - 'groupcode': '', - 'usercode': '', - 'report_date': '', - 'report_qty': '', - 'report_dvalue': '', - wx_code: '', - wx_name: '', - children: [] - }, - tableDataDialog: [], - - defectArr: [], // 涓嶈壇缂洪櫡 - - dialogFormRules: { - report_qty: [ - { required: true, message: '璇疯緭鍏ュ悎鏍兼暟閲�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getMesOrderStepVerifySearch() - this.getDefectPermissions() - this.getPrentOrganizationNoCompany() - }, - methods: { - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - async getDefectPermissions() { - const { data: res3 } = await DefectPermissions() // 缂洪櫡 - this.defectArr = res3 - }, - // 鎶ュ伐璋冩暣鍒楄〃鏌ヨ - async getMesOrderStepVerifySearch() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, - wo_code: this.form.wo_code, - partnumber: this.form.partnumber, - partname: this.form.partname, - partspec: this.form.partspec, - reportuser: this.form.reportuser, - reportdate: tempDate, - - prop: this.form.prop, // 鎺掑簭瀛楁 - order: this.form.order, // 鎺掑簭瀛楁 - page: this.form.page, // 绗嚑椤� - rows: this.form.rows // 姣忛〉澶氬皯鏉� - } - const res = await MesOrderStepVerifySearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMesOrderStepVerifySearch() - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.wo_code = '' - this.form.partnumber = '' - this.form.partname = '' - this.form.partspec = '' - this.form.reportuser = '' - this.form.reportdate = '' - this.getMesOrderStepVerifySearch() - }, - - // 鎶ュ伐璋冩暣 - async reportAdjust(row) { - const data = { - wo_code: row.wo_code, - step_code: row.step_code, - step_type: row.steptype, - isbott: row.first_choke, - isend: row.last_choke, - id: row.id, - sbid: row.sbid - } - const res = await MesOrderStepModelSearch(data) - if (res.code === '200') { - this.dialogForm.id = row.id - this.dialogForm.sbid = row.sbid - this.dialogForm.wo_code = row.wo_code - this.dialogForm.partnumber = row.partnumber - this.dialogForm.partname = row.partname - this.dialogForm.partspec = row.partspec - this.dialogForm.task_qty = row.task_qty - this.dialogForm.wkshp_code = row.wkshp_code - this.dialogForm.eqp_code = row.eqp_code - this.dialogForm.step_seq = row.step_seq - this.dialogForm.step_code = row.step_code - this.dialogForm.step_name = row.stepname - this.dialogForm.flw_type = row.steptype - this.dialogForm.first_choke = row.first_choke - this.dialogForm.last_choke = row.last_choke - this.dialogForm.unprice = row.step_price - this.dialogForm.groupcode = row.usergroup_code - this.dialogForm.usercode = row.usercode - this.dialogForm.usergroup_name = row.usergroup_name - this.dialogForm.username = row.username - this.dialogForm.report_date = row.report_date - this.dialogForm.report_qty = row.report_qty - this.dialogForm.report_qty2 = row.report_qty // old鍊� - - this.dialogForm.wx_code = row.wx_code - this.dialogForm.wx_name = row.wx_name - - if (res.data.length > 0) { - res.data.forEach(i => { - i.defect_code = i.defect_code.split(',') - i.defect_qty2 = i.defect_qty - i.laborbad_qty2 = i.laborbad_qty - i.materielbad_qty2 = i.materielbad_qty - }) - } - this.tableDataDialog = res.data - - this.dialogVisible = true - } - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - async dialogVisibleConfirm() { - this.$refs.dialogForm.validate(async valid => { - if (valid) { - const children = [] - - this.tableDataDialog.forEach(i => { - children.push({ - ng_id: i.id, - ng_sbid: i.record_id, - ng_qty: parseFloat(i.defect_qty), - ng_dvalue: parseFloat(i.defect_qty) - parseFloat(i.defect_qty2), - laborbad_qty: parseFloat(i.laborbad_qty), - laborbad_dvalue: parseFloat(i.laborbad_qty) - parseFloat(i.laborbad_qty2), - materielbad_qty: parseFloat(i.materielbad_qty), - materielbad_dvalue: parseFloat(i.materielbad_qty) - parseFloat(i.materielbad_qty2), - bad_money: 0, - badmoney_dvalue: 0 - }) - }) - const data = { - 'id': this.dialogForm.id, - 'sbid': this.dialogForm.sbid, - 'wo_code': this.dialogForm.wo_code, - 'partnumber': this.dialogForm.partnumber, - 'task_qty': this.dialogForm.task_qty, - 'wkshp_code': this.dialogForm.wkshp_code, - 'eqp_code': this.dialogForm.eqp_code, - 'step_seq': this.dialogForm.step_seq, - 'step_code': this.dialogForm.step_code, - 'flw_type': this.dialogForm.flw_type, - 'first_choke': this.dialogForm.first_choke, - 'last_choke': this.dialogForm.last_choke, - 'unprice': this.dialogForm.unprice, - 'groupcode': this.dialogForm.groupcode, - 'usercode': this.dialogForm.usercode, - wxcode: this.dialogForm.wx_code, - 'report_date': this.dialogForm.report_date, - 'report_qty': parseFloat(this.dialogForm.report_qty), - 'report_dvalue': parseFloat(this.dialogForm.report_qty) - parseFloat(this.dialogForm.report_qty2), - children - } - // console.log(JSON.stringify(data), 12) - // console.log(JSON.parse(JSON.stringify(data)), 12) - this.$store.state.app.buttonIsDisabled = true - const res = await MesOrderStepUpdateSeave([data]) - if (res.code === '200') { - this.$notify.success('璋冩暣鎴愬姛锛�') - await this.getMesOrderStepVerifySearch() - this.$store.state.app.buttonIsDisabled = false - this.dialogVisible = false - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error('璋冩暣澶辫触锛�') - } - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 205 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> - -<style scoped lang="scss"> -.dialogFormItem { - margin: 0 10px 0 0; -} - -::v-deep .el-dialog .el-divider__text { - font-weight: bolder !important; -} - -::v-deep .el-dialog .el-form-item__label { - font-weight: lighter !important; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div class="bodyTopFormGroup" style="margin-top: 10px;"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栫爜" style=" display: flex;"> + <el-input v-model="form.wo_code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partnumber" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧瑙勬牸" style=" display: flex;"> + <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style=" display: flex;"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getMesOrderStepVerifySearch">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- <el-table-column--> + <!-- type="selection"--> + <!-- width="50"--> + <!-- :reserve-selection="true"--> + <!-- fixed--> + <!-- />--> + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="鎶ュ伐宸ュ崟" + sortable="custom" + min-width="160" + show-overflow-tooltip + /> + <el-table-column + prop="partnumber" + label="浜у搧缂栫爜" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <!-- <el-table-column--> + <!-- prop="wkshp_name"--> + <!-- label="杞﹂棿鍚嶇О"--> + <!-- show-overflow-tooltip--> + <!-- sortable="custom"--> + <!-- min-width="110"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="eqp_name"--> + <!-- label="璁惧鍚嶇О"--> + <!-- sortable="custom"--> + <!-- show-overflow-tooltip--> + <!-- min-width="110"--> + <!-- />--> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <!-- <el-table-column--> + <!-- prop="step_price"--> + <!-- label="宸ュ簭鍗曚环"--> + <!-- show-overflow-tooltip--> + <!-- sortable="custom"--> + <!-- min-width="110"--> + <!-- />--> + <el-table-column + prop="steptype" + label="宸ュ簭绫诲瀷" + show-overflow-tooltip + sortable="custom" + min-width="110" + > + <template slot-scope="{row}"> + {{ row.steptype === 'Z' ? '鑷埗' : '澶栧崗' }} + </template> + </el-table-column> + <el-table-column + prop="wx_name" + label="渚涘簲鍟�" + show-overflow-tooltip + sortable="custom" + min-width="110" + > + <template slot-scope="{row}"> + {{ row.wx_name ? row.wx_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="usergroup_name" + label="鎶ュ伐鐝粍" + show-overflow-tooltip + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.usergroup_name ? row.usergroup_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="username" + label="鎶ュ伐浜哄憳" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="report_qty" + label="鍚堟牸鏁伴噺" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <el-table-column + prop="ng_qty" + label="涓嶈壇鏁伴噺" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="laborbad_qty" + label="宸ュ簾鏁伴噺" + min-width="110" + show-overflow-tooltip + sortable="custom" + /> + <el-table-column + prop="materielbad_qty" + label="鏂欏簾鏁伴噺" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎶ュ伐鏃堕棿" + min-width="160" + show-overflow-tooltip + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="100" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button + type="text" + style="cursor: pointer;font-size: 14px" + @click="reportAdjust(row)" + >鎶ュ伐璋冩暣 + </el-button> + + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getMesOrderStepVerifySearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鎶ュ伐璋冩暣" + :visible.sync="dialogVisible" + width="1080px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-divider content-position="left">宸ュ崟淇℃伅</el-divider> + + <el-form-item label="宸ュ崟缂栧彿" class="dialogFormItem"> + <div style="width: 200px;"> + {{ dialogForm.wo_code }} + </div> + <!-- <el-input v-model="dialogForm.postcode" style="width: 200px" />--> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" class="dialogFormItem"> + <div style="width: 200px;"> + {{ dialogForm.partnumber }} + </div> + <!-- <el-input v-model="dialogForm.postname" style="width: 200px" />--> + </el-form-item> + <el-form-item label="浜у搧鍚嶇О" class="dialogFormItem"> + <div style="width: 200px;"> + {{ dialogForm.partname }} + </div> + </el-form-item> + <el-form-item label="浜у搧瑙勬牸" class="dialogFormItem"> + <div style="width: 200px;"> + {{ dialogForm.partspec ? dialogForm.partspec : '/' }} + </div> + </el-form-item> + <el-form-item label="鐢熶骇宸ュ簭" class="dialogFormItem"> + <div style="width: 200px;"> + {{ dialogForm.step_name }} + </div> + </el-form-item> + <el-form-item label="宸ュ簭鍗曚环" class="dialogFormItem"> + <!-- <div style="width: 200px;">--> + <!-- {{ dialogForm.unprice ? dialogForm.unprice : '/' }}--> + <!-- </div>--> + <el-input + v-model="dialogForm.unprice" + oninput="value=value.replace(/[^0-9.]/g,'')" + style="width: 200px" + /> + </el-form-item> + <el-form-item v-if="dialogForm.flw_type==='Z'" label="鎶ュ伐鐝粍" class="dialogFormItem"> + <div style="width: 200px;" class="ellipsis"> + {{ dialogForm.usergroup_name ? dialogForm.usergroup_name : '/' }} + </div> + </el-form-item> + <el-form-item v-if="dialogForm.flw_type!=='Z'" label="渚涘簲鍟�" class="dialogFormItem"> + <div style="width: 200px;" class="ellipsis"> + {{ dialogForm.wx_name }} + </div> + </el-form-item> + <el-form-item label="鎶ュ伐浜哄憳" class="dialogFormItem"> + <div style="width: 200px;" class="ellipsis"> + {{ dialogForm.username }} + </div> + </el-form-item> + <el-form-item :label="dialogForm.flw_type==='Z'?'鍚堟牸鏁伴噺':'鏀舵枡鏁伴噺'" prop="report_qty" class="dialogFormItem"> + <el-input + v-model="dialogForm.report_qty" + oninput="value=value.replace(/[^0-9]/g,'')" + style="width: 200px" + /> + </el-form-item> + + <el-divider content-position="left">鎶ュ伐鎯呭喌</el-divider> + + <el-table + ref="tableDataDialogRef" + key="tableDataDialogKey" + :data="tableDataDialog" + border + row-class-name="custom-row" + height="200" + style="width: 100%;margin-top: 15px;" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + label="搴忓彿" + align="center" + width="50" + /> + <el-table-column + prop="stepcode" + show-tooltip-when-overflow + label="缂洪櫡缂栫爜/鍚嶇О" + align="center" + min-width="400" + > + <template slot-scope="{row}"> + <el-select + v-model="row.defect_code" + style="width: 100%" + placeholder="璇烽�夋嫨" + multiple + filterable + > + <!-- collapse-tags--> + <el-option + v-for="item in defectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + + <el-table-column + prop="defect_qty" + label="涓嶈壇鏁伴噺" + align="center" + > + <template slot-scope="{row}"> + <el-input + v-model="row.defect_qty" + placeholder="璇疯緭鍏ユ暟閲�" + oninput="value=value.replace(/[^0-9]/g,'')" + style="width: 100%" + /> + </template> + </el-table-column> + <el-table-column + prop="laborbad_qty" + label="宸ュ簾鏁伴噺" + align="center" + > + <template slot-scope="{row}"> + <el-input + v-model="row.laborbad_qty" + placeholder="璇疯緭鍏ユ暟閲�" + oninput="value=value.replace(/[^0-9]/g,'')" + style="width: 100%" + /> + </template> + </el-table-column> + <el-table-column + prop="materielbad_qty" + label="鏂欏簾鏁伴噺" + align="center" + > + <template slot-scope="{row}"> + <el-input + v-model="row.materielbad_qty" + placeholder="璇疯緭鍏ユ暟閲�" + oninput="value=value.replace(/[^0-9]/g,'')" + style="width: 100%" + /> + </template> + </el-table-column> + </el-table> + + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { DefectPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData' +import { MesOrderStepModelSearch, MesOrderStepUpdateSeave, MesOrderStepVerifySearch } from '@/api/WorkOrder' + +export default { + name: 'ReportCorrect', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', + wo_code: '', // 宸ュ崟缂栫爜 + partnumber: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 浜у搧瑙勬牸 + reportuser: '', // 鎶ュ伐浜哄憳 + reportdate: '', // 鎶ュ伐鏃堕棿 + + prop: 'report_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + wkshopcodeArr: [], + dialogVisible: false, + dialogForm: { + 'id': '', + 'sbid': '', + 'wo_code': '', + 'partnumber': '', + partname: '', + partspec: '', + usergroup_name: '', + username: '', + 'task_qty': '', + 'wkshp_code': '', + 'eqp_code': '', + 'step_seq': '', + 'step_code': '', + 'step_name': '', + 'flw_type': '', + 'first_choke': '', + 'last_choke': '', + 'unprice': '', + 'groupcode': '', + 'usercode': '', + 'report_date': '', + 'report_qty': '', + 'report_dvalue': '', + wx_code: '', + wx_name: '', + children: [] + }, + tableDataDialog: [], + + defectArr: [], // 涓嶈壇缂洪櫡 + + dialogFormRules: { + report_qty: [ + { required: true, message: '璇疯緭鍏ュ悎鏍兼暟閲�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getMesOrderStepVerifySearch() + this.getDefectPermissions() + this.getPrentOrganizationNoCompany() + }, + created() { + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getMesOrderStepVerifySearch() + this.getDefectPermissions() + this.getPrentOrganizationNoCompany() + }, + methods: { + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + async getDefectPermissions() { + const { data: res3 } = await DefectPermissions() // 缂洪櫡 + this.defectArr = res3 + }, + // 鎶ュ伐璋冩暣鍒楄〃鏌ヨ + async getMesOrderStepVerifySearch() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, + wo_code: this.form.wo_code, + partnumber: this.form.partnumber, + partname: this.form.partname, + partspec: this.form.partspec, + reportuser: this.form.reportuser, + reportdate: tempDate, + + prop: this.form.prop, // 鎺掑簭瀛楁 + order: this.form.order, // 鎺掑簭瀛楁 + page: this.form.page, // 绗嚑椤� + rows: this.form.rows // 姣忛〉澶氬皯鏉� + } + const res = await MesOrderStepVerifySearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMesOrderStepVerifySearch() + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.wo_code = '' + this.form.partnumber = '' + this.form.partname = '' + this.form.partspec = '' + this.form.reportuser = '' + this.form.reportdate = '' + this.getMesOrderStepVerifySearch() + }, + + // 鎶ュ伐璋冩暣 + async reportAdjust(row) { + const data = { + wo_code: row.wo_code, + step_code: row.step_code, + step_type: row.steptype, + isbott: row.first_choke, + isend: row.last_choke, + id: row.id, + sbid: row.sbid + } + const res = await MesOrderStepModelSearch(data) + if (res.code === '200') { + this.dialogForm.id = row.id + this.dialogForm.sbid = row.sbid + this.dialogForm.wo_code = row.wo_code + this.dialogForm.partnumber = row.partnumber + this.dialogForm.partname = row.partname + this.dialogForm.partspec = row.partspec + this.dialogForm.task_qty = row.task_qty + this.dialogForm.wkshp_code = row.wkshp_code + this.dialogForm.eqp_code = row.eqp_code + this.dialogForm.step_seq = row.step_seq + this.dialogForm.step_code = row.step_code + this.dialogForm.step_name = row.stepname + this.dialogForm.flw_type = row.steptype + this.dialogForm.first_choke = row.first_choke + this.dialogForm.last_choke = row.last_choke + this.dialogForm.unprice = row.step_price + this.dialogForm.groupcode = row.usergroup_code + this.dialogForm.usercode = row.usercode + this.dialogForm.usergroup_name = row.usergroup_name + this.dialogForm.username = row.username + this.dialogForm.report_date = row.report_date + this.dialogForm.report_qty = row.report_qty + this.dialogForm.report_qty2 = row.report_qty // old鍊� + + this.dialogForm.wx_code = row.wx_code + this.dialogForm.wx_name = row.wx_name + + if (res.data.length > 0) { + res.data.forEach(i => { + i.defect_code = i.defect_code.split(',') + i.defect_qty2 = i.defect_qty + i.laborbad_qty2 = i.laborbad_qty + i.materielbad_qty2 = i.materielbad_qty + }) + } + this.tableDataDialog = res.data + + this.dialogVisible = true + } + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + async dialogVisibleConfirm() { + this.$refs.dialogForm.validate(async valid => { + if (valid) { + const children = [] + + this.tableDataDialog.forEach(i => { + children.push({ + ng_id: i.id, + ng_sbid: i.record_id, + ng_qty: parseFloat(i.defect_qty), + ng_dvalue: parseFloat(i.defect_qty) - parseFloat(i.defect_qty2), + laborbad_qty: parseFloat(i.laborbad_qty), + laborbad_dvalue: parseFloat(i.laborbad_qty) - parseFloat(i.laborbad_qty2), + materielbad_qty: parseFloat(i.materielbad_qty), + materielbad_dvalue: parseFloat(i.materielbad_qty) - parseFloat(i.materielbad_qty2), + bad_money: 0, + badmoney_dvalue: 0 + }) + }) + const data = { + 'id': this.dialogForm.id, + 'sbid': this.dialogForm.sbid, + 'wo_code': this.dialogForm.wo_code, + 'partnumber': this.dialogForm.partnumber, + 'task_qty': this.dialogForm.task_qty, + 'wkshp_code': this.dialogForm.wkshp_code, + 'eqp_code': this.dialogForm.eqp_code, + 'step_seq': this.dialogForm.step_seq, + 'step_code': this.dialogForm.step_code, + 'flw_type': this.dialogForm.flw_type, + 'first_choke': this.dialogForm.first_choke, + 'last_choke': this.dialogForm.last_choke, + 'unprice': this.dialogForm.unprice, + 'groupcode': this.dialogForm.groupcode, + 'usercode': this.dialogForm.usercode, + wxcode: this.dialogForm.wx_code, + 'report_date': this.dialogForm.report_date, + 'report_qty': parseFloat(this.dialogForm.report_qty), + 'report_dvalue': parseFloat(this.dialogForm.report_qty) - parseFloat(this.dialogForm.report_qty2), + children + } + // console.log(JSON.stringify(data), 12) + // console.log(JSON.parse(JSON.stringify(data)), 12) + this.$store.state.app.buttonIsDisabled = true + const res = await MesOrderStepUpdateSeave([data]) + if (res.code === '200') { + this.$notify.success('璋冩暣鎴愬姛锛�') + await this.getMesOrderStepVerifySearch() + this.$store.state.app.buttonIsDisabled = false + this.dialogVisible = false + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error('璋冩暣澶辫触锛�') + } + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 205 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> + +<style scoped lang="scss"> +.dialogFormItem { + margin: 0 10px 0 0; +} + +::v-deep .el-dialog .el-divider__text { + font-weight: bolder !important; +} + +::v-deep .el-dialog .el-form-item__label { + font-weight: lighter !important; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +</style> diff --git a/src/views/produce/reportVerify.vue b/src/views/produce/reportVerify.vue index bae9dc5..2b1224e 100644 --- a/src/views/produce/reportVerify.vue +++ b/src/views/produce/reportVerify.vue @@ -1,566 +1,572 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-check" @click="reportAdjust()">鎶ュ伐瀹℃牳</el-button> - <!-- <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=2')">瀵煎叆</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="瀹℃牳鐘舵��" style=" display: flex;"> - <el-select - v-model="form.reviewstatus" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in reviewstatusArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栫爜" style=" display: flex;"> - <el-input v-model="form.wo_code" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partnumber" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <!-- <el-form-item v-show="isExpandForm" label="浜у搧瑙勬牸" style=" display: flex;">--> - <!-- <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style=" display: flex;"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getMesOrderStepReportVerifySearch">鏌ヨ - </el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - @selection-change="handleSelectionChange" - > - <el-table-column - type="selection" - width="50" - :selectable="selected" - fixed - /> - <el-table-column - prop="rowNum" - width="80" - fixed - label="搴忓彿" - /> - <el-table-column - prop="verify" - label="鏄惁宸插鏍�" - sortable="custom" - width="120" - show-overflow-tooltip - > - <template slot-scope="{row}"> - <el-tag v-if="row.verify==='Y'" size="small" type="success">宸插鏍�</el-tag> - <el-tag v-if="row.verify==='N'" size="small" type="danger">鏈鏍�</el-tag> - </template> - </el-table-column> - <el-table-column - prop="wo_code" - label="鎶ュ伐宸ュ崟" - sortable="custom" - min-width="160" - show-overflow-tooltip - /> - <el-table-column - prop="partnumber" - label="浜у搧缂栫爜" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - sortable="custom" - show-overflow-tooltip - min-width="110" - /> - <!-- <el-table-column--> - <!-- prop="wkshp_name"--> - <!-- label="杞﹂棿鍚嶇О"--> - <!-- show-overflow-tooltip--> - <!-- sortable="custom"--> - <!-- min-width="110"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="eqp_name"--> - <!-- label="璁惧鍚嶇О"--> - <!-- sortable="custom"--> - <!-- show-overflow-tooltip--> - <!-- min-width="110"--> - <!-- />--> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <!-- <el-table-column--> - <!-- prop="step_price"--> - <!-- label="宸ュ簭鍗曚环"--> - <!-- show-overflow-tooltip--> - <!-- sortable="custom"--> - <!-- min-width="110"--> - <!-- />--> - <el-table-column - prop="steptype" - label="宸ュ簭绫诲瀷" - show-overflow-tooltip - sortable="custom" - min-width="110" - > - <template slot-scope="{row}"> - {{ row.steptype === 'Z' ? '鑷埗' : '澶栧崗' }} - </template> - </el-table-column> - <el-table-column - prop="wx_name" - label="渚涘簲鍟�" - show-overflow-tooltip - sortable="custom" - min-width="110" - > - <template slot-scope="{row}"> - {{ row.wx_name ? row.wx_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="usergroup_name" - label="鎶ュ伐鐝粍" - show-overflow-tooltip - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.usergroup_name ? row.usergroup_name : '/' }} - </template> - </el-table-column> - <el-table-column - prop="username" - label="鎶ュ伐浜哄憳" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="report_qty" - label="鍚堟牸鏁伴噺" - show-overflow-tooltip - sortable="custom" - min-width="110" - /> - <el-table-column - prop="ng_qty" - label="涓嶈壇鏁伴噺" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="laborbad_qty" - label="宸ュ簾鏁伴噺" - min-width="110" - show-overflow-tooltip - sortable="custom" - /> - <el-table-column - prop="materielbad_qty" - label="鏂欏簾鏁伴噺" - show-overflow-tooltip - min-width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎶ュ伐鏃堕棿" - min-width="160" - show-overflow-tooltip - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="100" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button - v-if="row.verify!=='Y'" - type="text" - style="cursor: pointer;font-size: 14px" - @click="reportAdjust(row)" - >鎶ュ伐瀹℃牳 - </el-button> - <el-button - v-if="row.verify==='Y'" - type="text" - style="cursor: pointer;font-size: 14px;color: rgba(255,0,0,0.8)" - @click="reportGiveUp(row)" - >寮冨 - </el-button> - - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getMesOrderStepReportVerifySearch" - /> - </div> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - MesOrderDistribution, - MesOrderStepReportNotVerifySeave, - MesOrderStepReportVerifySearch, - MesOrderStepReportVerifySeave -} from '@/api/WorkOrder' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'ReportVerify', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', - wo_code: '', // 宸ュ崟缂栫爜 - partnumber: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 浜у搧瑙勬牸 - - stepname: '', // 宸ュ簭鍚嶇О - reportuser: '', // 鎶ュ伐浜哄憳 - reportdate: '', // 鎶ュ伐鏃堕棿 - - reviewstatus: '', // 瀹℃牳鐘舵�� - - prop: 'report_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - wkshopcodeArr: [], - - multipleSelection: [], - reviewstatusArr: [ - { code: 'Y', name: '宸插鏍�' }, - { code: 'N', name: '鏈鏍�' } - ] - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getMesOrderStepReportVerifySearch() - this.getPrentOrganizationNoCompany() - }, - methods: { - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - // 鎶ュ伐璋冩暣鍒楄〃鏌ヨ - async getMesOrderStepReportVerifySearch() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, - wo_code: this.form.wo_code, - reviewstatus: this.form.reviewstatus, - partnumber: this.form.partnumber, - partname: this.form.partname, - partspec: this.form.partspec, - reportuser: this.form.reportuser, - stepname: this.form.stepname, - reportdate: tempDate, - - prop: this.form.prop, // 鎺掑簭瀛楁 - order: this.form.order, // 鎺掑簭瀛楁 - page: this.form.page, // 绗嚑椤� - rows: this.form.rows // 姣忛〉澶氬皯鏉� - } - const res = await MesOrderStepReportVerifySearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMesOrderStepReportVerifySearch() - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.wo_code = '' - this.form.partnumber = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.reportuser = '' - this.form.reportdate = '' - this.form.reviewstatus = '' - this.getMesOrderStepReportVerifySearch() - }, - - // 鎶ュ伐瀹℃牳 - async reportAdjust(row) { - // if (row && row.verify === 'Y') { - // return this.$message.info('姝ゅ伐鍗曞凡瀹℃牳锛�') - // } - this.$confirm('鏄惁纭瀹℃牳?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - if (row) { - this.multipleSelection = [row] - } - const data = { - zdata: [], - wdata: [] - } - this.multipleSelection.forEach(i => { - if (i.steptype === 'Z') { - data.zdata.push(i.id) - } else { - data.wdata.push(i.id) - } - }) - MesOrderStepReportVerifySeave(data).then(res => { - if (res.code === '200') { - this.$notify.success('瀹℃牳鎴愬姛锛�') - this.getMesOrderStepReportVerifySearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝鏍革紒') - }) - }, - // 寮冨 - reportGiveUp(row) { - this.$confirm('鏄惁纭寮冨?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const data = { - id: row.id, - steptype: row.steptype - } - - MesOrderStepReportNotVerifySeave(data).then(res => { - if (res.code === '200') { - this.$notify.success('寮冨鎴愬姛锛�') - this.getMesOrderStepReportVerifySearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝純瀹★紒') - }) - }, - - handleSelectionChange(val) { - this.multipleSelection = val - }, - selected(row) { - return row.verify === 'N' - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> - -<style scoped lang="scss"> -.dialogFormItem { - margin: 0 10px 0 0; -} - -::v-deep .el-dialog .el-divider__text { - font-weight: bolder !important; -} - -::v-deep .el-dialog .el-form-item__label { - font-weight: lighter !important; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-check" @click="reportAdjust()">鎶ュ伐瀹℃牳</el-button> + <!-- <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=2')">瀵煎叆</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="瀹℃牳鐘舵��" style=" display: flex;"> + <el-select + v-model="form.reviewstatus" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in reviewstatusArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栫爜" style=" display: flex;"> + <el-input v-model="form.wo_code" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partnumber" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <!-- <el-form-item v-show="isExpandForm" label="浜у搧瑙勬牸" style=" display: flex;">--> + <!-- <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportuser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style=" display: flex;"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getMesOrderStepReportVerifySearch">鏌ヨ + </el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + @selection-change="handleSelectionChange" + > + <el-table-column + type="selection" + width="50" + :selectable="selected" + fixed + /> + <el-table-column + prop="rowNum" + width="80" + fixed + label="搴忓彿" + /> + <el-table-column + prop="verify" + label="鏄惁宸插鏍�" + sortable="custom" + width="120" + show-overflow-tooltip + > + <template slot-scope="{row}"> + <el-tag v-if="row.verify==='Y'" size="small" type="success">宸插鏍�</el-tag> + <el-tag v-if="row.verify==='N'" size="small" type="danger">鏈鏍�</el-tag> + </template> + </el-table-column> + <el-table-column + prop="wo_code" + label="鎶ュ伐宸ュ崟" + sortable="custom" + min-width="160" + show-overflow-tooltip + /> + <el-table-column + prop="partnumber" + label="浜у搧缂栫爜" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + sortable="custom" + show-overflow-tooltip + min-width="110" + /> + <!-- <el-table-column--> + <!-- prop="wkshp_name"--> + <!-- label="杞﹂棿鍚嶇О"--> + <!-- show-overflow-tooltip--> + <!-- sortable="custom"--> + <!-- min-width="110"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="eqp_name"--> + <!-- label="璁惧鍚嶇О"--> + <!-- sortable="custom"--> + <!-- show-overflow-tooltip--> + <!-- min-width="110"--> + <!-- />--> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <!-- <el-table-column--> + <!-- prop="step_price"--> + <!-- label="宸ュ簭鍗曚环"--> + <!-- show-overflow-tooltip--> + <!-- sortable="custom"--> + <!-- min-width="110"--> + <!-- />--> + <el-table-column + prop="steptype" + label="宸ュ簭绫诲瀷" + show-overflow-tooltip + sortable="custom" + min-width="110" + > + <template slot-scope="{row}"> + {{ row.steptype === 'Z' ? '鑷埗' : '澶栧崗' }} + </template> + </el-table-column> + <el-table-column + prop="wx_name" + label="渚涘簲鍟�" + show-overflow-tooltip + sortable="custom" + min-width="110" + > + <template slot-scope="{row}"> + {{ row.wx_name ? row.wx_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="usergroup_name" + label="鎶ュ伐鐝粍" + show-overflow-tooltip + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.usergroup_name ? row.usergroup_name : '/' }} + </template> + </el-table-column> + <el-table-column + prop="username" + label="鎶ュ伐浜哄憳" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="report_qty" + label="鍚堟牸鏁伴噺" + show-overflow-tooltip + sortable="custom" + min-width="110" + /> + <el-table-column + prop="ng_qty" + label="涓嶈壇鏁伴噺" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="laborbad_qty" + label="宸ュ簾鏁伴噺" + min-width="110" + show-overflow-tooltip + sortable="custom" + /> + <el-table-column + prop="materielbad_qty" + label="鏂欏簾鏁伴噺" + show-overflow-tooltip + min-width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎶ュ伐鏃堕棿" + min-width="160" + show-overflow-tooltip + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="100" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button + v-if="row.verify!=='Y'" + type="text" + style="cursor: pointer;font-size: 14px" + @click="reportAdjust(row)" + >鎶ュ伐瀹℃牳 + </el-button> + <el-button + v-if="row.verify==='Y'" + type="text" + style="cursor: pointer;font-size: 14px;color: rgba(255,0,0,0.8)" + @click="reportGiveUp(row)" + >寮冨 + </el-button> + + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getMesOrderStepReportVerifySearch" + /> + </div> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + MesOrderDistribution, + MesOrderStepReportNotVerifySeave, + MesOrderStepReportVerifySearch, + MesOrderStepReportVerifySeave +} from '@/api/WorkOrder' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'ReportVerify', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', + wo_code: '', // 宸ュ崟缂栫爜 + partnumber: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 浜у搧瑙勬牸 + + stepname: '', // 宸ュ簭鍚嶇О + reportuser: '', // 鎶ュ伐浜哄憳 + reportdate: '', // 鎶ュ伐鏃堕棿 + + reviewstatus: '', // 瀹℃牳鐘舵�� + + prop: 'report_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + wkshopcodeArr: [], + + multipleSelection: [], + reviewstatusArr: [ + { code: 'Y', name: '宸插鏍�' }, + { code: 'N', name: '鏈鏍�' } + ] + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getMesOrderStepReportVerifySearch() + this.getPrentOrganizationNoCompany() + }, + created() { + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getMesOrderStepReportVerifySearch() + this.getPrentOrganizationNoCompany() + }, + methods: { + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + // 鎶ュ伐璋冩暣鍒楄〃鏌ヨ + async getMesOrderStepReportVerifySearch() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, + wo_code: this.form.wo_code, + reviewstatus: this.form.reviewstatus, + partnumber: this.form.partnumber, + partname: this.form.partname, + partspec: this.form.partspec, + reportuser: this.form.reportuser, + stepname: this.form.stepname, + reportdate: tempDate, + + prop: this.form.prop, // 鎺掑簭瀛楁 + order: this.form.order, // 鎺掑簭瀛楁 + page: this.form.page, // 绗嚑椤� + rows: this.form.rows // 姣忛〉澶氬皯鏉� + } + const res = await MesOrderStepReportVerifySearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMesOrderStepReportVerifySearch() + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.wo_code = '' + this.form.partnumber = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.reportuser = '' + this.form.reportdate = '' + this.form.reviewstatus = '' + this.getMesOrderStepReportVerifySearch() + }, + + // 鎶ュ伐瀹℃牳 + async reportAdjust(row) { + // if (row && row.verify === 'Y') { + // return this.$message.info('姝ゅ伐鍗曞凡瀹℃牳锛�') + // } + this.$confirm('鏄惁纭瀹℃牳?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + if (row) { + this.multipleSelection = [row] + } + const data = { + zdata: [], + wdata: [] + } + this.multipleSelection.forEach(i => { + if (i.steptype === 'Z') { + data.zdata.push(i.id) + } else { + data.wdata.push(i.id) + } + }) + MesOrderStepReportVerifySeave(data).then(res => { + if (res.code === '200') { + this.$notify.success('瀹℃牳鎴愬姛锛�') + this.getMesOrderStepReportVerifySearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝鏍革紒') + }) + }, + // 寮冨 + reportGiveUp(row) { + this.$confirm('鏄惁纭寮冨?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const data = { + id: row.id, + steptype: row.steptype + } + + MesOrderStepReportNotVerifySeave(data).then(res => { + if (res.code === '200') { + this.$notify.success('寮冨鎴愬姛锛�') + this.getMesOrderStepReportVerifySearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝純瀹★紒') + }) + }, + + handleSelectionChange(val) { + this.multipleSelection = val + }, + selected(row) { + return row.verify === 'N' + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> + +<style scoped lang="scss"> +.dialogFormItem { + margin: 0 10px 0 0; +} + +::v-deep .el-dialog .el-divider__text { + font-weight: bolder !important; +} + +::v-deep .el-dialog .el-form-item__label { + font-weight: lighter !important; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +</style> diff --git a/src/views/produce/stepReport.vue b/src/views/produce/stepReport.vue index e9ae386..48b6a11 100644 --- a/src/views/produce/stepReport.vue +++ b/src/views/produce/stepReport.vue @@ -1115,6 +1115,8 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.tabClick() + this.getAllSelectArr() }, created() { diff --git a/src/views/qualityManager/defectDefine.vue b/src/views/qualityManager/defectDefine.vue index 00591aa..d22171b 100644 --- a/src/views/qualityManager/defectDefine.vue +++ b/src/views/qualityManager/defectDefine.vue @@ -1,356 +1,361 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button - v-waves - type="success" - icon="el-icon-download" - @click="$router.push('./../systemSetting/dataImport?fileCode=18')" - >瀵煎叆 - </el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="缂洪櫡缂栫爜" style=" display: flex;"> - <el-input v-model="form.defectcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="缂洪櫡鍚嶇О" style=" display: flex;"> - <el-input v-model="form.defectname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getDedectSearch">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="code" - label="缂洪櫡缂栫爜" - sortable="custom" - /> - <el-table-column - prop="name" - label="缂洪櫡鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="description" - label="鎻忚堪" - sortable="custom" - > - <template slot-scope="{row}"> - {{ row.description ? row.description : '/' }} - </template> - </el-table-column> - <el-table-column - prop="lm_user" - label="鍒涘缓浜哄憳" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鍒涘缓鏃堕棿" - width="160" - sortable="custom" - /> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - v-if="row.leve!==0" - class="el-icon-delete" - :style="{color:$store.state.settings.theme}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getDedectSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="缂洪櫡缂栫爜" prop="defectcode"> - <el-input v-model="dialogForm.defectcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="缂洪櫡鍚嶇О" prop="defectname"> - <el-input v-model="dialogForm.defectname" style="width: 200px" /> - </el-form-item> - <el-form-item label="鎻忚堪"> - <el-input - v-model="dialogForm.defectdescr" - type="textarea" - style="width: 200px" - /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateOrganization, AddUpdatePost, - DeleteOrganization, DeletePost, PostData, - PrentOrganization, - STorgData -} from '@/api/basicSettings' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { AddUpdateDedect, DedectSearch, DeleteDedect } from '@/api/QualityManagement' - -export default { - name: 'DefectDefine', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - defectcode: '', // 缁勭粐鏋舵瀯缂栫爜 - defectname: '', // 缁勭粐鏋舵瀯鍚嶇О - defectdescr: '', - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - defectcode: '', // 缁勭粐缂栫爜 - defectname: '', // 缁勭粐鍚嶇О - defectdescr: '', // 鎻忚堪 - OperType: '' - }, - operation: '', - dialogFormRules: { - defectcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - defectname: [ - { required: true, message: '璇疯緭鍏ョ己闄峰悕绉�', trigger: ['blur', 'change'] } - ] - } - - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getDedectSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� - async getDedectSearch() { - const res = await DedectSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDedectSearch() - }, - // 閲嶇疆 - reset() { - this.form.defectcode = '' - this.form.defectname = '' - this.getDedectSearch() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Add' - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - this.dialogForm.OperType = 'Update' - - this.$nextTick(() => { - this.dialogForm.defectcode = row.code - this.dialogForm.defectname = row.name - this.dialogForm.defectdescr = row.description - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDedect({ defectcode: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDedectSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.defectcode = '' - this.dialogForm.defectname = '' - this.dialogForm.defectdescr = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - AddUpdateDedect(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getDedectSearch() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 200 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button + v-waves + type="success" + icon="el-icon-download" + @click="$router.push('./../systemSetting/dataImport?fileCode=18')" + >瀵煎叆 + </el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="缂洪櫡缂栫爜" style=" display: flex;"> + <el-input v-model="form.defectcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="缂洪櫡鍚嶇О" style=" display: flex;"> + <el-input v-model="form.defectname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getDedectSearch">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="code" + label="缂洪櫡缂栫爜" + sortable="custom" + /> + <el-table-column + prop="name" + label="缂洪櫡鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="description" + label="鎻忚堪" + sortable="custom" + > + <template slot-scope="{row}"> + {{ row.description ? row.description : '/' }} + </template> + </el-table-column> + <el-table-column + prop="lm_user" + label="鍒涘缓浜哄憳" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鍒涘缓鏃堕棿" + width="160" + sortable="custom" + /> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + v-if="row.leve!==0" + class="el-icon-delete" + :style="{color:$store.state.settings.theme}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getDedectSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="缂洪櫡缂栫爜" prop="defectcode"> + <el-input v-model="dialogForm.defectcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="缂洪櫡鍚嶇О" prop="defectname"> + <el-input v-model="dialogForm.defectname" style="width: 200px" /> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input + v-model="dialogForm.defectdescr" + type="textarea" + style="width: 200px" + /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateOrganization, AddUpdatePost, + DeleteOrganization, DeletePost, PostData, + PrentOrganization, + STorgData +} from '@/api/basicSettings' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { AddUpdateDedect, DedectSearch, DeleteDedect } from '@/api/QualityManagement' + +export default { + name: 'DefectDefine', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + defectcode: '', // 缁勭粐鏋舵瀯缂栫爜 + defectname: '', // 缁勭粐鏋舵瀯鍚嶇О + defectdescr: '', + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + defectcode: '', // 缁勭粐缂栫爜 + defectname: '', // 缁勭粐鍚嶇О + defectdescr: '', // 鎻忚堪 + OperType: '' + }, + operation: '', + dialogFormRules: { + defectcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + defectname: [ + { required: true, message: '璇疯緭鍏ョ己闄峰悕绉�', trigger: ['blur', 'change'] } + ] + } + + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getDedectSearch() + }, + created() { + this.getDedectSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇� + async getDedectSearch() { + const res = await DedectSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDedectSearch() + }, + // 閲嶇疆 + reset() { + this.form.defectcode = '' + this.form.defectname = '' + this.getDedectSearch() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Add' + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + this.dialogForm.OperType = 'Update' + + this.$nextTick(() => { + this.dialogForm.defectcode = row.code + this.dialogForm.defectname = row.name + this.dialogForm.defectdescr = row.description + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDedect({ defectcode: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDedectSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.defectcode = '' + this.dialogForm.defectname = '' + this.dialogForm.defectdescr = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + AddUpdateDedect(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getDedectSearch() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 200 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/qualityManager/processCheck.vue b/src/views/qualityManager/processCheck.vue index a8f8a25..72bd3b7 100644 --- a/src/views/qualityManager/processCheck.vue +++ b/src/views/qualityManager/processCheck.vue @@ -1,802 +1,807 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}" style="background-color: #eaecef"> - - <div - style="background-color: #f8f8fa;margin: 10px 0; - overflow-y:auto;overflow-x: hidden; - display: flex;flex-direction: column" - :style="{height:mainHeight+'px'}" - > - <div class="content1"> - <div> - <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> - </div> - <div class="title"> - 鎵弿淇℃伅 - </div> - </div> - - <div class="content2"> - <el-form :inline="true" label-width="80px"> - <el-form-item label="妫�楠岀被鍨�"> - <el-select - v-model="form.checktype" - style="width: 160px;" - placeholder="璇烽�夋嫨" - filterable - > - <el-option - v-for="item in checktypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鎵爜鏉$爜"> - <el-input - v-model="form.orderstepqrcode" - name="GXproduceCode" - style="width: 250px" - placeholder="璇锋壂鐮佸伐鍗曞伐搴忕爜" - @keyup.enter.native="enterNative" - /> - </el-form-item> - </el-form> - </div> - - <div class="content1"> - <div> - <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> - </div> - <div class="title"> - 宸ュ崟淇℃伅 - </div> - </div> - <div class="content2" style="width: 60%;margin-left: 30px;"> - <div class="orderMsg">鍗曟嵁缂栧彿锛歿{ form.wocode }}</div> - <div class="orderMsg">鐗╂枡缂栫爜锛歿{ form.partcode }}</div> - <div class="orderMsg">鐗╂枡鍚嶇О锛歿{ form.partname }}</div> - </div> - <div class="content2" style="width: 60%;margin-left: 30px;"> - <div class="orderMsg">鐗╂枡瑙勬牸锛歿{ form.partspec }}</div> - <div class="orderMsg">宸ュ簭缂栫爜锛歿{ form.stepcode }}</div> - <div class="orderMsg">宸ュ簭鍚嶇О锛歿{ form.stepname }}</div> - </div> - - <div class="content1"> - <div> - <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> - </div> - <div class="title"> - 璐ㄦ鏂规 - </div> - </div> - <div class="content2" style="width: 60%;margin-left: 30px;"> - <div class="orderMsg">鏂规鍚嶇О锛歿{ form.checkstandname }}</div> - <div class="orderMsg">鎶芥牱鏂瑰紡锛歿{ - form.sampmethod === 'FIXED' ? '鍥烘椂鎶芥' : form.sampmethod === 'SCARE' ? '姣斾緥鎶芥' : '' - }} - </div> - </div> - <div class="content2" style="width: 60%;margin-left: 30px;"> - <div class="orderMsg">鎶ュ伐鏁伴噺锛歿{ form.good_qty }}</div> - <div class="orderMsg">鏍锋湰鏁伴噺锛� - <el-input-number - v-if="form.good_qty" - v-model="form.sampscare" - :max="form.good_qty" - :min="1" - size="medium" - @change="numberChange" - /> - </div> - </div> - - <div - v-if="checkItemArr.length>0" - class="content1" - > - <div> - <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> - </div> - <div class="title"> - 妫�楠岄」鐩� - </div> - </div> - <div - v-if="form.sampscare!==1&&checkItemArr.length>0" - class="content2" - style="width: 60%;" - > - <el-link :underline="false" :disabled="!(stepActive>0)" style="width: 60px;margin-top: 5px" @click="pre">涓婁竴浠� - </el-link> - <el-steps :active="stepActive" style="width: 70%;margin:0 10px;" finish-status="success"> - <el-step v-for="item in form.sampscare" :key="item" title="" /> - </el-steps> - <el-link - :underline="false" - :disabled="!(stepActive < form.sampscare-1)" - style="width: 60px;margin-top: 5px" - @click="next" - >涓嬩竴浠� - </el-link> - </div> - - <div - class="content2" - style="flex-direction: column;justify-content:flex-start;width: 480px;margin-top: 10px;" - > - - <div - v-for="(item,index) in checkItemArr" - v-if="stepActive+1===item.checkNumber" - :key="item.code+(stepActive+1).toString()" - :style="{borderBottom:(index+1)%checkItemArr.map(i=>i.checkNumber===1).filter(i=>i).length!==0?`1px solid rgba(48,49,51,0.2)`:''}" - class="checkItem" - > - - <div style="display: flex;justify-content: space-between;align-items: center"> - <div style="display: flex;width: 300px;"> - <div class="serialNumber">{{ item.stepcheckitem_seq }}</div> - <div style="display: flex;align-items: center">{{ item.name }}</div> - </div> - - <div v-show="item.numberjudge==='N'" style="width: 150px;display: flex;padding-left: 20px"> - <el-button - type="primary" - size="mini" - :plain="!item.check_result" - @click="checkResultClick('OK',item)" - >鍚堟牸 - </el-button> - <el-button - type="warning" - size="mini" - :plain="item.check_result" - @click="checkResultClick('NG',item)" - >涓嶅悎鏍� - </el-button> - </div> - <div v-show="item.numberjudge!=='N'" style="width: 150px;" /> - </div> - - <div style="display: flex;margin-bottom: 5px"> - <div style="display: flex;flex-direction: column"> - <div v-if="item.standvalue" class="itemTitle">鏍囧噯鍊�</div> - <div v-if="item.uppervalue" class="itemTitle">涓婇檺鍊�</div> - <div v-if="item.lowervalue" class="itemTitle">涓嬮檺鍊�</div> - <div v-if="item.stepcheckitem_desc" class="itemTitle">鎻忚堪</div> - <div v-if="item.numberjudge!=='N'" class="itemTitle">瀹炴祴鍊� - <el-input - v-model="item.real_value" - size="mini" - oninput="value=value.replace(/[^0-9.]/g,'')" - style="width: 100px;margin-left: 5px" - @input="val=>inputChange(val,item)" - /> - </div> - </div> - <div style="display: flex;flex-direction: column"> - <div v-if="item.standvalue" class="itemContent">{{ item.standvalue }}</div> - <div v-if="item.uppervalue" class="itemContent">{{ item.uppervalue }}</div> - <div v-if="item.lowervalue" class="itemContent">{{ item.lowervalue }}</div> - <div v-if="item.stepcheckitem_desc" class="itemContent">{{ item.stepcheckitem_desc }}</div> - - <div v-show="item.numberjudge!=='N'" class="itemContent" style="width: 150px;display: flex"> - <el-button - type="primary" - size="mini" - :disabled="item.required==='Y'&&!item.real_value" - :plain="!item.check_result" - @click="checkResultClick('OK',item)" - >鍚堟牸 - </el-button> - <el-button - type="warning" - size="mini" - :disabled="item.required==='Y'&&!item.real_value" - :plain="item.check_result" - @click="checkResultClick('NG',item)" - > - 涓嶅悎鏍� - </el-button> - </div> - </div> - </div> - - </div> - - </div> - - <div - v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" - class="content1" - > - <div> - <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> - </div> - <div class="title"> - 妫�楠岀粨鏋� - </div> - </div> - - <div - v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" - class="content2" - style="width: 60%;margin-left: 30px;" - > - <div class="orderMsg2">鏍锋湰鏁伴噺锛歿{ form.sampscare }}</div> - <div class="orderMsg2">鍚堟牸鏁伴噺锛歿{ form.goodqty }}</div> - <div class="orderMsg2">涓嶅悎鏍兼暟閲忥細{{ form.ngqty }}</div> - - <div style="width: 290px;display: flex;align-items: center" class="resultButton"> - <div style="width: 70px;">鍒ゅ畾缁撴灉锛�</div> - <el-button type="primary" size="medium" :plain="!check_result" @click="check_result=true">鍚堟牸</el-button> - <el-button type="warning" size="medium" :plain="check_result" @click="check_result=false">涓嶅悎鏍�</el-button> - </div> - </div> - - <div - v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" - class="content2 submitButton" - style="margin-top: 10px;margin-bottom: 10px;" - > - <el-button - v-waves - type="primary" - @click="submitButton" - >鎻愪氦 - </el-button> - </div> - - </div> - - </div> - </div> -</template> - -<script> -import waves from '@/directive/waves' -import $ from 'jquery' -import { MesOrderStepCheckItemList, MesOrderStepCheckSearch, SaveMesOrderStepCheckItem } from '@/api/QualityManagement' -import { getCookie } from '@/utils/auth' - -export default { - name: 'ProcessCheck', - - directives: { waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - - form: { - orderstepqrcode: '', // 鎵弿宸ュ簭浜岀淮鐮佷俊鎭� - checktype: 'FirstCheck', - - wocode: '', - partcode: '', - partname: '', - partspec: '', - stepcode: '', - stepname: '', - checkstandcode: '', - checkstandname: '', - check_type: '', - sampmethod: '', // FIXED(鍥烘椂鎶芥) SCARE(姣斾緥鎶芥) - sampscare: '', - qualitystatus: '', - good_qty: '', // 鎸囩殑鎶ュ伐鏁伴噺 - sampleqty: '', - goodqty: '', // 鍚堟牸鏁伴噺 - ngqty: '', // 涓嶈壇鏁伴噺 - // checkitemcont: [], - - username: getCookie('admin') - - }, - checktypeArr: [ - { code: 'FirstCheck', name: '棣栨' }, - { code: 'PatroCheck', name: '宸℃' }, - { code: 'EndCheck', name: '瀹屽伐妫�' } - ], - stepActive: 0, // 褰撳墠澶勪簬绗嚑浠� - - checkItemArr: [], - check_result: '' - - } - }, - - watch: { - 'checkItemArr': { - deep: true, // 娣卞害鐩戝惉鏃� 鐩戝惉鍒板睘鎬� 褰撲笉涓烘繁搴︾洃鍚椂锛屽彲鐩戝惉闀垮害 - handler: function(val) { - // do something with the new and old value of myArray - this.form.goodqty = 0 - for (var i = 0; i < this.form.sampscare; i++) { - const flag = this.checkItemArr.filter(j => j.checkNumber === i + 1).every(j => j.check_result) - if (flag) { - this.form.goodqty++ - } - } - this.form.ngqty = this.form.sampscare - this.form.goodqty - } - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getFocus() - }, - methods: { - // 鑾峰彇鑱氱劍 - getFocus() { - this.$nextTick(() => { - $('input[name=\'GXproduceCode\']')[0].focus() - }) - }, - async enterNative() { - const data = { - orderstepqrcode: this.form.orderstepqrcode, - checktype: this.form.checktype, - stu_torgcode: getCookie('stu_torgcode') - } - const { data: res } = await MesOrderStepCheckSearch(data) - this.form.wocode = res.labcont[0].wo_code - this.form.partcode = res.labcont[0].partcode - this.form.partname = res.labcont[0].partname - this.form.partspec = res.labcont[0].partspec ? res.labcont[0].partspec : '/' - this.form.stepcode = res.labcont[0].stepcode - this.form.stepname = res.labcont[0].stepname - this.form.good_qty = res.labcont[0].good_qty - - this.form.checkstandcode = res.chekstand[0].checkstandcode - this.form.checkstandname = res.chekstand[0].checkstandname - this.form.sampmethod = res.chekstand[0].sampmethod - - this.form.sampscare = res.chekstand[0].sampmethod === 'FIXED' ? res.chekstand[0].sampscare - : res.labcont[0].good_qty * res.chekstand[0].sampscare / 100 - this.form.sampscare = this.form.sampscare <= this.form.good_qty ? this.form.sampscare : this.form.good_qty - this.form.sampscare = Math.ceil(this.form.sampscare)// 鍚戜笂鍙栨暣 - await this.getMesOrderStepCheckItemList() - }, - async getMesOrderStepCheckItemList() { - const { data: res } = await MesOrderStepCheckItemList({ checkstandcode: this.form.checkstandcode }) - // this.checkItemArr = res - this.checkItemArr = [] - for (let i = 0; i < this.form.sampscare; i++) { - res.forEach(j => { - this.checkItemArr.push({ - checkNumber: i + 1, - stepcheckitem_seq: j.stepcheckitem_seq, - name: j.name, - code: j.code, - standvalue: j.standvalue, - lowervalue: j.lowervalue, - uppervalue: j.uppervalue, - - unit: j.unit, - stepcheckitem_desc: j.stepcheckitem_desc, - required: j.required, // 鏄惁蹇呭~ - numberjudge: j.numberjudge, // 鏁板�煎垽鏂� - real_value: '', - check_result: j.numberjudge === 'Y' ? '' : true - }) - }) - } - - if (this.checkItemArr.every(i => i.check_result)) { - this.check_result = true - } else { - this.check_result = '' - } - }, - - numberChange(currentValue, oldValue) { - const t = this.checkItemArr.filter(i => i.checkNumber === 1) - - // 浠舵暟鍙樺皯鏃舵墽琛� - if (currentValue < this.checkItemArr.length / t.length) { - this.checkItemArr.reverse() - this.checkItemArr.splice(0, t.length * (oldValue - currentValue)) - this.checkItemArr.reverse() - - this.stepActive = currentValue - 1 - } - // 浠舵暟鍙樺鏃舵墽琛� - if (currentValue > this.checkItemArr.length / t.length) { - for (let i = currentValue; i > oldValue; i--) { - t.forEach(j => { - this.checkItemArr.push({ - checkNumber: i, - name: j.name, - code: j.code, - standvalue: j.standvalue, - lowervalue: j.lowervalue, - uppervalue: j.uppervalue, - stepcheckitem_seq: j.stepcheckitem_seq, - unit: j.unit, - stepcheckitem_desc: j.stepcheckitem_desc, - required: j.required, // 鏄惁蹇呭~ - numberjudge: j.numberjudge, // 鏁板�煎垽鏂� - real_value: '', - check_result: j.numberjudge === 'Y' ? '' : true - }) - }) - } - this.checkItemArr.sort((a, b) => a.checkNumber - b.checkNumber) - } - }, - - pre() { - if (this.stepActive > 0) { - this.stepActive-- - } - }, - next() { - if (this.stepActive < this.form.sampscare) { - this.stepActive++ - } - }, - - inputChange(val, item) { - if (val !== '') { - if (item.numberjudge === 'Y') { // 濡傛灉闇�瑕佽繘琛屾暟鍊煎垽鏂� - if (item.uppervalue === '' && item.lowervalue === '') { // 涓婇檺鍊间负绌猴紝涓嬮檺鍊间负绌� - item.check_result = parseFloat(val) === parseFloat(item.standvalue) - } - - if (item.uppervalue !== '' && item.lowervalue !== '') { // 涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间笉涓虹┖ - item.check_result = parseFloat(val) >= parseFloat(item.lowervalue) && parseFloat(val) <= - parseFloat(item.uppervalue) - } - - if (item.uppervalue !== '' && item.lowervalue === '') { // 涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间负绌� - item.check_result = parseFloat(val) <= parseFloat(item.uppervalue) - } - - if (item.uppervalue === '' && item.lowervalue !== '') { // 涓婇檺鍊间负绌猴紝涓嬮檺鍊间笉涓虹┖ - item.check_result = parseFloat(val) >= parseFloat(item.lowervalue) - } - } - } - - if (val === '') { - item.check_result = '' - } - - this.check_result = !!this.checkItemArr.every(i => i.check_result) - }, - - checkResultClick(val, item) { - item.check_result = val === 'OK' - - if (this.checkItemArr.filter(i => i.check_result !== '').length === this.checkItemArr.length) { - this.check_result = !!this.checkItemArr.every(i => i.check_result) - } - }, - - submitButton() { - this.$confirm('鏄惁纭鎻愪氦?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const checkitemcont = [] - this.checkItemArr.forEach((i, index) => { - checkitemcont.push({ - checknum: i.checkNumber + '/' + this.checkItemArr.length / this - .checkItemArr.filter(j => j.checkNumber === 1).length, - checkiem_seq: i.stepcheckitem_seq, - checkitem_code: i.code, - checkitem_name: i.name, - check_value: i.real_value ? i.real_value : '', - check_result: i.check_result ? 'OK' : 'NG', - checkitem_descr: '' - }) - }) - - const data = { - stu_torgcode: getCookie('stu_torgcode'), - wocode: this.form.wocode, - partcode: this.form.partcode, - stepcode: this.form.stepcode, - checkstandcode: this.form.checkstandcode, - check_type: this.form.checktype, - sampmethod: this.form.sampmethod, - qualitystatus: this.check_result ? 'OK' : 'NG', - good_qty: this.form.good_qty, - sampleqty: this.form.sampscare, - goodqty: this.form.goodqty, - ngqty: this.form.ngqty, - admin: this.form.username, - checkitemcont - } - - SaveMesOrderStepCheckItem(data).then(res => { - if (res.code === '200') { - this.form.orderstepqrcode = '' - - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepcode = '' - this.form.stepname = '' - this.form.checkstandcode = '' - this.form.checkstandname = '' - this.form.check_type = '' - this.form.sampmethod = ''// FIXED(鍥烘椂鎶芥) SCARE(姣斾緥鎶芥) - this.form.sampscare = '' - this.form.qualitystatus = '' - this.form.good_qty = '' // 鎸囩殑鎶ュ伐鏁伴噺 - this.form.sampleqty = '' - this.form.goodqty = '' // 鍚堟牸鏁伴噺 - this.form.ngqty = '' // 涓嶈壇鏁伴噺 - this.stepActive = 0 - this.checkItemArr = [] - this.check_result = '' - this.$message.success('妫�楠屾垚鍔燂紒') - this.getFocus() - } - }) - }) - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<!--鍏叡椤甸潰鏍峰紡--> -<style lang="scss" scoped> -$main_color: #42b983; -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} - -.el-icon-share, .el-icon-delete, .el-icon-edit-outline { - color: $main_color; - cursor: pointer; -} - -.el-icon-edit-outline { - margin-right: 15px; -} - -::v-deep .el-button--primary, .el-button--warning, .el-button--default, .el-button--info { - //height: 34px; - //display: flex; - //align-items: center; - //padding: 0 15px; - width: 58px; - display: flex; - align-items: center; - justify-content: center; -} - -.submitButton { - ::v-deep .el-button--primary { - width: 160px; - letter-spacing: 10px; - padding-left: 25px; - font-size: 18px; - //display: flex; - //justify-content: center; - //align-items: center; - } -} - -.resultButton { - ::v-deep .el-button--primary { - width: 100px; - letter-spacing: 4px; - padding-left: 22px; - } - - ::v-deep .el-button--warning { - width: 100px; - letter-spacing: 4px; - padding-left: 22px; - } -} - -::v-deep .el-button--default { - background-color: #f8f8fa; - border: none; -} - -::v-deep .el-input__inner { - height: 34px; - line-height: 34px; - //color: #a7a7a7; -} - -::v-deep .el-dialog__body { - padding: 20px 100px !important; -} - -::v-deep .dialogVisibleRoles .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .importPickerClass .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .el-dialog__footer { - display: flex; - justify-content: flex-end; -} - -::v-deep .el-table .caret-wrapper { - transform: scale(0.8); -} - -::v-deep .cell { - display: flex; - align-items: center; - justify-content: space-between; -} - -::v-deep .el-table::before { - height: 0; -} - -::v-deep .el-table__body-wrapper { - background-color: #f8f8fa; -} - -::v-deep .el-table__body .el-table__row.hover-row td { - background-color: #eaecef; -} - -::v-deep .el-form--inline .el-form-item__label { - //color: #a7a7a7; - //font-size: 16px; -} - -.body ::v-deep .el-divider { - border: 1px solid #eee; - width: 99%; - margin: 10px auto; -} - -.body ::v-deep .el-form-item { - margin-bottom: 0; -} - -.userDialogVisible ::v-deep .el-form-item { - margin-bottom: 0; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -.tableFixed { - ::v-deep .el-table__fixed-right { - height: 100% !important; - } - - ::v-deep .el-table__fixed { - height: 100% !important; - } -} -</style> - -<style lang="scss" scoped> -.content1 { - display: flex; - align-items: center; - margin: 10px 0 0 10px; - - .title { - font-size: 14px; - font-weight: bold; - margin-left: 5px; - } -} - -.content2 { - margin: 10px 0 0 20px; - display: flex; - font-size: 14px; - width: 100%; - align-items: center; -} - -.orderMsg { - width: 33.33%; - display: flex; - align-items: center; -} - -::v-deep .el-input-number--medium { - line-height: 32px; - width: 120px; -} - -.checkItem { - display: flex; - justify-content: space-between; - min-height: 36px; - - align-items: center; - flex-direction: column; - margin-top: 5px; -} - -.serialNumber { - width: 20px; - height: 20px; - border-radius: 50%; - background-color: #42B983; - color: #fff; - display: flex; - align-items: center; - justify-content: center; - margin-right: 10px; -} - -.itemTitle { - width: 300px; - padding-left: 40px; - height: 26px; - color: #909399; - display: flex; - align-items: center; - - ::v-deep .el-input--mini { - line-height: 24px; - height: 24px; - } - - ::v-deep .el-input__inner { - line-height: 24px; - height: 24px; - } -} - -.itemContent { - width: 150px; - height: 26px; - padding-left: 20px; - display: flex; - align-items: center; - -} - -.orderMsg2 { - width: 200px; -} -</style> - -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}" style="background-color: #eaecef"> + + <div + style="background-color: #f8f8fa;margin: 10px 0; + overflow-y:auto;overflow-x: hidden; + display: flex;flex-direction: column" + :style="{height:mainHeight+'px'}" + > + <div class="content1"> + <div> + <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> + </div> + <div class="title"> + 鎵弿淇℃伅 + </div> + </div> + + <div class="content2"> + <el-form :inline="true" label-width="80px"> + <el-form-item label="妫�楠岀被鍨�"> + <el-select + v-model="form.checktype" + style="width: 160px;" + placeholder="璇烽�夋嫨" + filterable + > + <el-option + v-for="item in checktypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鎵爜鏉$爜"> + <el-input + v-model="form.orderstepqrcode" + name="GXproduceCode" + style="width: 250px" + placeholder="璇锋壂鐮佸伐鍗曞伐搴忕爜" + @keyup.enter.native="enterNative" + /> + </el-form-item> + </el-form> + </div> + + <div class="content1"> + <div> + <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> + </div> + <div class="title"> + 宸ュ崟淇℃伅 + </div> + </div> + <div class="content2" style="width: 60%;margin-left: 30px;"> + <div class="orderMsg">鍗曟嵁缂栧彿锛歿{ form.wocode }}</div> + <div class="orderMsg">鐗╂枡缂栫爜锛歿{ form.partcode }}</div> + <div class="orderMsg">鐗╂枡鍚嶇О锛歿{ form.partname }}</div> + </div> + <div class="content2" style="width: 60%;margin-left: 30px;"> + <div class="orderMsg">鐗╂枡瑙勬牸锛歿{ form.partspec }}</div> + <div class="orderMsg">宸ュ簭缂栫爜锛歿{ form.stepcode }}</div> + <div class="orderMsg">宸ュ簭鍚嶇О锛歿{ form.stepname }}</div> + </div> + + <div class="content1"> + <div> + <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> + </div> + <div class="title"> + 璐ㄦ鏂规 + </div> + </div> + <div class="content2" style="width: 60%;margin-left: 30px;"> + <div class="orderMsg">鏂规鍚嶇О锛歿{ form.checkstandname }}</div> + <div class="orderMsg">鎶芥牱鏂瑰紡锛歿{ + form.sampmethod === 'FIXED' ? '鍥烘椂鎶芥' : form.sampmethod === 'SCARE' ? '姣斾緥鎶芥' : '' + }} + </div> + </div> + <div class="content2" style="width: 60%;margin-left: 30px;"> + <div class="orderMsg">鎶ュ伐鏁伴噺锛歿{ form.good_qty }}</div> + <div class="orderMsg">鏍锋湰鏁伴噺锛� + <el-input-number + v-if="form.good_qty" + v-model="form.sampscare" + :max="form.good_qty" + :min="1" + size="medium" + @change="numberChange" + /> + </div> + </div> + + <div + v-if="checkItemArr.length>0" + class="content1" + > + <div> + <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> + </div> + <div class="title"> + 妫�楠岄」鐩� + </div> + </div> + <div + v-if="form.sampscare!==1&&checkItemArr.length>0" + class="content2" + style="width: 60%;" + > + <el-link :underline="false" :disabled="!(stepActive>0)" style="width: 60px;margin-top: 5px" @click="pre">涓婁竴浠� + </el-link> + <el-steps :active="stepActive" style="width: 70%;margin:0 10px;" finish-status="success"> + <el-step v-for="item in form.sampscare" :key="item" title="" /> + </el-steps> + <el-link + :underline="false" + :disabled="!(stepActive < form.sampscare-1)" + style="width: 60px;margin-top: 5px" + @click="next" + >涓嬩竴浠� + </el-link> + </div> + + <div + class="content2" + style="flex-direction: column;justify-content:flex-start;width: 480px;margin-top: 10px;" + > + + <div + v-for="(item,index) in checkItemArr" + v-if="stepActive+1===item.checkNumber" + :key="item.code+(stepActive+1).toString()" + :style="{borderBottom:(index+1)%checkItemArr.map(i=>i.checkNumber===1).filter(i=>i).length!==0?`1px solid rgba(48,49,51,0.2)`:''}" + class="checkItem" + > + + <div style="display: flex;justify-content: space-between;align-items: center"> + <div style="display: flex;width: 300px;"> + <div class="serialNumber">{{ item.stepcheckitem_seq }}</div> + <div style="display: flex;align-items: center">{{ item.name }}</div> + </div> + + <div v-show="item.numberjudge==='N'" style="width: 150px;display: flex;padding-left: 20px"> + <el-button + type="primary" + size="mini" + :plain="!item.check_result" + @click="checkResultClick('OK',item)" + >鍚堟牸 + </el-button> + <el-button + type="warning" + size="mini" + :plain="item.check_result" + @click="checkResultClick('NG',item)" + >涓嶅悎鏍� + </el-button> + </div> + <div v-show="item.numberjudge!=='N'" style="width: 150px;" /> + </div> + + <div style="display: flex;margin-bottom: 5px"> + <div style="display: flex;flex-direction: column"> + <div v-if="item.standvalue" class="itemTitle">鏍囧噯鍊�</div> + <div v-if="item.uppervalue" class="itemTitle">涓婇檺鍊�</div> + <div v-if="item.lowervalue" class="itemTitle">涓嬮檺鍊�</div> + <div v-if="item.stepcheckitem_desc" class="itemTitle">鎻忚堪</div> + <div v-if="item.numberjudge!=='N'" class="itemTitle">瀹炴祴鍊� + <el-input + v-model="item.real_value" + size="mini" + oninput="value=value.replace(/[^0-9.]/g,'')" + style="width: 100px;margin-left: 5px" + @input="val=>inputChange(val,item)" + /> + </div> + </div> + <div style="display: flex;flex-direction: column"> + <div v-if="item.standvalue" class="itemContent">{{ item.standvalue }}</div> + <div v-if="item.uppervalue" class="itemContent">{{ item.uppervalue }}</div> + <div v-if="item.lowervalue" class="itemContent">{{ item.lowervalue }}</div> + <div v-if="item.stepcheckitem_desc" class="itemContent">{{ item.stepcheckitem_desc }}</div> + + <div v-show="item.numberjudge!=='N'" class="itemContent" style="width: 150px;display: flex"> + <el-button + type="primary" + size="mini" + :disabled="item.required==='Y'&&!item.real_value" + :plain="!item.check_result" + @click="checkResultClick('OK',item)" + >鍚堟牸 + </el-button> + <el-button + type="warning" + size="mini" + :disabled="item.required==='Y'&&!item.real_value" + :plain="item.check_result" + @click="checkResultClick('NG',item)" + > + 涓嶅悎鏍� + </el-button> + </div> + </div> + </div> + + </div> + + </div> + + <div + v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" + class="content1" + > + <div> + <i class="el-icon-s-operation" style="font-size: 14px" :style="{color:$store.state.settings.theme}" /> + </div> + <div class="title"> + 妫�楠岀粨鏋� + </div> + </div> + + <div + v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" + class="content2" + style="width: 60%;margin-left: 30px;" + > + <div class="orderMsg2">鏍锋湰鏁伴噺锛歿{ form.sampscare }}</div> + <div class="orderMsg2">鍚堟牸鏁伴噺锛歿{ form.goodqty }}</div> + <div class="orderMsg2">涓嶅悎鏍兼暟閲忥細{{ form.ngqty }}</div> + + <div style="width: 290px;display: flex;align-items: center" class="resultButton"> + <div style="width: 70px;">鍒ゅ畾缁撴灉锛�</div> + <el-button type="primary" size="medium" :plain="!check_result" @click="check_result=true">鍚堟牸</el-button> + <el-button type="warning" size="medium" :plain="check_result" @click="check_result=false">涓嶅悎鏍�</el-button> + </div> + </div> + + <div + v-if="checkItemArr.filter(i=>i.check_result!=='').length===checkItemArr.length&&checkItemArr.length>0" + class="content2 submitButton" + style="margin-top: 10px;margin-bottom: 10px;" + > + <el-button + v-waves + type="primary" + @click="submitButton" + >鎻愪氦 + </el-button> + </div> + + </div> + + </div> + </div> +</template> + +<script> +import waves from '@/directive/waves' +import $ from 'jquery' +import { MesOrderStepCheckItemList, MesOrderStepCheckSearch, SaveMesOrderStepCheckItem } from '@/api/QualityManagement' +import { getCookie } from '@/utils/auth' + +export default { + name: 'ProcessCheck', + + directives: { waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + + form: { + orderstepqrcode: '', // 鎵弿宸ュ簭浜岀淮鐮佷俊鎭� + checktype: 'FirstCheck', + + wocode: '', + partcode: '', + partname: '', + partspec: '', + stepcode: '', + stepname: '', + checkstandcode: '', + checkstandname: '', + check_type: '', + sampmethod: '', // FIXED(鍥烘椂鎶芥) SCARE(姣斾緥鎶芥) + sampscare: '', + qualitystatus: '', + good_qty: '', // 鎸囩殑鎶ュ伐鏁伴噺 + sampleqty: '', + goodqty: '', // 鍚堟牸鏁伴噺 + ngqty: '', // 涓嶈壇鏁伴噺 + // checkitemcont: [], + + username: getCookie('admin') + + }, + checktypeArr: [ + { code: 'FirstCheck', name: '棣栨' }, + { code: 'PatroCheck', name: '宸℃' }, + { code: 'EndCheck', name: '瀹屽伐妫�' } + ], + stepActive: 0, // 褰撳墠澶勪簬绗嚑浠� + + checkItemArr: [], + check_result: '' + + } + }, + + watch: { + 'checkItemArr': { + deep: true, // 娣卞害鐩戝惉鏃� 鐩戝惉鍒板睘鎬� 褰撲笉涓烘繁搴︾洃鍚椂锛屽彲鐩戝惉闀垮害 + handler: function(val) { + // do something with the new and old value of myArray + this.form.goodqty = 0 + for (var i = 0; i < this.form.sampscare; i++) { + const flag = this.checkItemArr.filter(j => j.checkNumber === i + 1).every(j => j.check_result) + if (flag) { + this.form.goodqty++ + } + } + this.form.ngqty = this.form.sampscare - this.form.goodqty + } + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getFocus() + }, + created() { + + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getFocus() + }, + methods: { + // 鑾峰彇鑱氱劍 + getFocus() { + this.$nextTick(() => { + $('input[name=\'GXproduceCode\']')[0].focus() + }) + }, + async enterNative() { + const data = { + orderstepqrcode: this.form.orderstepqrcode, + checktype: this.form.checktype, + stu_torgcode: getCookie('stu_torgcode') + } + const { data: res } = await MesOrderStepCheckSearch(data) + this.form.wocode = res.labcont[0].wo_code + this.form.partcode = res.labcont[0].partcode + this.form.partname = res.labcont[0].partname + this.form.partspec = res.labcont[0].partspec ? res.labcont[0].partspec : '/' + this.form.stepcode = res.labcont[0].stepcode + this.form.stepname = res.labcont[0].stepname + this.form.good_qty = res.labcont[0].good_qty + + this.form.checkstandcode = res.chekstand[0].checkstandcode + this.form.checkstandname = res.chekstand[0].checkstandname + this.form.sampmethod = res.chekstand[0].sampmethod + + this.form.sampscare = res.chekstand[0].sampmethod === 'FIXED' ? res.chekstand[0].sampscare + : res.labcont[0].good_qty * res.chekstand[0].sampscare / 100 + this.form.sampscare = this.form.sampscare <= this.form.good_qty ? this.form.sampscare : this.form.good_qty + this.form.sampscare = Math.ceil(this.form.sampscare)// 鍚戜笂鍙栨暣 + await this.getMesOrderStepCheckItemList() + }, + async getMesOrderStepCheckItemList() { + const { data: res } = await MesOrderStepCheckItemList({ checkstandcode: this.form.checkstandcode }) + // this.checkItemArr = res + this.checkItemArr = [] + for (let i = 0; i < this.form.sampscare; i++) { + res.forEach(j => { + this.checkItemArr.push({ + checkNumber: i + 1, + stepcheckitem_seq: j.stepcheckitem_seq, + name: j.name, + code: j.code, + standvalue: j.standvalue, + lowervalue: j.lowervalue, + uppervalue: j.uppervalue, + + unit: j.unit, + stepcheckitem_desc: j.stepcheckitem_desc, + required: j.required, // 鏄惁蹇呭~ + numberjudge: j.numberjudge, // 鏁板�煎垽鏂� + real_value: '', + check_result: j.numberjudge === 'Y' ? '' : true + }) + }) + } + + if (this.checkItemArr.every(i => i.check_result)) { + this.check_result = true + } else { + this.check_result = '' + } + }, + + numberChange(currentValue, oldValue) { + const t = this.checkItemArr.filter(i => i.checkNumber === 1) + + // 浠舵暟鍙樺皯鏃舵墽琛� + if (currentValue < this.checkItemArr.length / t.length) { + this.checkItemArr.reverse() + this.checkItemArr.splice(0, t.length * (oldValue - currentValue)) + this.checkItemArr.reverse() + + this.stepActive = currentValue - 1 + } + // 浠舵暟鍙樺鏃舵墽琛� + if (currentValue > this.checkItemArr.length / t.length) { + for (let i = currentValue; i > oldValue; i--) { + t.forEach(j => { + this.checkItemArr.push({ + checkNumber: i, + name: j.name, + code: j.code, + standvalue: j.standvalue, + lowervalue: j.lowervalue, + uppervalue: j.uppervalue, + stepcheckitem_seq: j.stepcheckitem_seq, + unit: j.unit, + stepcheckitem_desc: j.stepcheckitem_desc, + required: j.required, // 鏄惁蹇呭~ + numberjudge: j.numberjudge, // 鏁板�煎垽鏂� + real_value: '', + check_result: j.numberjudge === 'Y' ? '' : true + }) + }) + } + this.checkItemArr.sort((a, b) => a.checkNumber - b.checkNumber) + } + }, + + pre() { + if (this.stepActive > 0) { + this.stepActive-- + } + }, + next() { + if (this.stepActive < this.form.sampscare) { + this.stepActive++ + } + }, + + inputChange(val, item) { + if (val !== '') { + if (item.numberjudge === 'Y') { // 濡傛灉闇�瑕佽繘琛屾暟鍊煎垽鏂� + if (item.uppervalue === '' && item.lowervalue === '') { // 涓婇檺鍊间负绌猴紝涓嬮檺鍊间负绌� + item.check_result = parseFloat(val) === parseFloat(item.standvalue) + } + + if (item.uppervalue !== '' && item.lowervalue !== '') { // 涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间笉涓虹┖ + item.check_result = parseFloat(val) >= parseFloat(item.lowervalue) && parseFloat(val) <= + parseFloat(item.uppervalue) + } + + if (item.uppervalue !== '' && item.lowervalue === '') { // 涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间负绌� + item.check_result = parseFloat(val) <= parseFloat(item.uppervalue) + } + + if (item.uppervalue === '' && item.lowervalue !== '') { // 涓婇檺鍊间负绌猴紝涓嬮檺鍊间笉涓虹┖ + item.check_result = parseFloat(val) >= parseFloat(item.lowervalue) + } + } + } + + if (val === '') { + item.check_result = '' + } + + this.check_result = !!this.checkItemArr.every(i => i.check_result) + }, + + checkResultClick(val, item) { + item.check_result = val === 'OK' + + if (this.checkItemArr.filter(i => i.check_result !== '').length === this.checkItemArr.length) { + this.check_result = !!this.checkItemArr.every(i => i.check_result) + } + }, + + submitButton() { + this.$confirm('鏄惁纭鎻愪氦?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const checkitemcont = [] + this.checkItemArr.forEach((i, index) => { + checkitemcont.push({ + checknum: i.checkNumber + '/' + this.checkItemArr.length / this + .checkItemArr.filter(j => j.checkNumber === 1).length, + checkiem_seq: i.stepcheckitem_seq, + checkitem_code: i.code, + checkitem_name: i.name, + check_value: i.real_value ? i.real_value : '', + check_result: i.check_result ? 'OK' : 'NG', + checkitem_descr: '' + }) + }) + + const data = { + stu_torgcode: getCookie('stu_torgcode'), + wocode: this.form.wocode, + partcode: this.form.partcode, + stepcode: this.form.stepcode, + checkstandcode: this.form.checkstandcode, + check_type: this.form.checktype, + sampmethod: this.form.sampmethod, + qualitystatus: this.check_result ? 'OK' : 'NG', + good_qty: this.form.good_qty, + sampleqty: this.form.sampscare, + goodqty: this.form.goodqty, + ngqty: this.form.ngqty, + admin: this.form.username, + checkitemcont + } + + SaveMesOrderStepCheckItem(data).then(res => { + if (res.code === '200') { + this.form.orderstepqrcode = '' + + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepcode = '' + this.form.stepname = '' + this.form.checkstandcode = '' + this.form.checkstandname = '' + this.form.check_type = '' + this.form.sampmethod = ''// FIXED(鍥烘椂鎶芥) SCARE(姣斾緥鎶芥) + this.form.sampscare = '' + this.form.qualitystatus = '' + this.form.good_qty = '' // 鎸囩殑鎶ュ伐鏁伴噺 + this.form.sampleqty = '' + this.form.goodqty = '' // 鍚堟牸鏁伴噺 + this.form.ngqty = '' // 涓嶈壇鏁伴噺 + this.stepActive = 0 + this.checkItemArr = [] + this.check_result = '' + this.$message.success('妫�楠屾垚鍔燂紒') + this.getFocus() + } + }) + }) + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<!--鍏叡椤甸潰鏍峰紡--> +<style lang="scss" scoped> +$main_color: #42b983; +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} + +.el-icon-share, .el-icon-delete, .el-icon-edit-outline { + color: $main_color; + cursor: pointer; +} + +.el-icon-edit-outline { + margin-right: 15px; +} + +::v-deep .el-button--primary, .el-button--warning, .el-button--default, .el-button--info { + //height: 34px; + //display: flex; + //align-items: center; + //padding: 0 15px; + width: 58px; + display: flex; + align-items: center; + justify-content: center; +} + +.submitButton { + ::v-deep .el-button--primary { + width: 160px; + letter-spacing: 10px; + padding-left: 25px; + font-size: 18px; + //display: flex; + //justify-content: center; + //align-items: center; + } +} + +.resultButton { + ::v-deep .el-button--primary { + width: 100px; + letter-spacing: 4px; + padding-left: 22px; + } + + ::v-deep .el-button--warning { + width: 100px; + letter-spacing: 4px; + padding-left: 22px; + } +} + +::v-deep .el-button--default { + background-color: #f8f8fa; + border: none; +} + +::v-deep .el-input__inner { + height: 34px; + line-height: 34px; + //color: #a7a7a7; +} + +::v-deep .el-dialog__body { + padding: 20px 100px !important; +} + +::v-deep .dialogVisibleRoles .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .importPickerClass .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .el-dialog__footer { + display: flex; + justify-content: flex-end; +} + +::v-deep .el-table .caret-wrapper { + transform: scale(0.8); +} + +::v-deep .cell { + display: flex; + align-items: center; + justify-content: space-between; +} + +::v-deep .el-table::before { + height: 0; +} + +::v-deep .el-table__body-wrapper { + background-color: #f8f8fa; +} + +::v-deep .el-table__body .el-table__row.hover-row td { + background-color: #eaecef; +} + +::v-deep .el-form--inline .el-form-item__label { + //color: #a7a7a7; + //font-size: 16px; +} + +.body ::v-deep .el-divider { + border: 1px solid #eee; + width: 99%; + margin: 10px auto; +} + +.body ::v-deep .el-form-item { + margin-bottom: 0; +} + +.userDialogVisible ::v-deep .el-form-item { + margin-bottom: 0; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +.tableFixed { + ::v-deep .el-table__fixed-right { + height: 100% !important; + } + + ::v-deep .el-table__fixed { + height: 100% !important; + } +} +</style> + +<style lang="scss" scoped> +.content1 { + display: flex; + align-items: center; + margin: 10px 0 0 10px; + + .title { + font-size: 14px; + font-weight: bold; + margin-left: 5px; + } +} + +.content2 { + margin: 10px 0 0 20px; + display: flex; + font-size: 14px; + width: 100%; + align-items: center; +} + +.orderMsg { + width: 33.33%; + display: flex; + align-items: center; +} + +::v-deep .el-input-number--medium { + line-height: 32px; + width: 120px; +} + +.checkItem { + display: flex; + justify-content: space-between; + min-height: 36px; + + align-items: center; + flex-direction: column; + margin-top: 5px; +} + +.serialNumber { + width: 20px; + height: 20px; + border-radius: 50%; + background-color: #42B983; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + margin-right: 10px; +} + +.itemTitle { + width: 300px; + padding-left: 40px; + height: 26px; + color: #909399; + display: flex; + align-items: center; + + ::v-deep .el-input--mini { + line-height: 24px; + height: 24px; + } + + ::v-deep .el-input__inner { + line-height: 24px; + height: 24px; + } +} + +.itemContent { + width: 150px; + height: 26px; + padding-left: 20px; + display: flex; + align-items: center; + +} + +.orderMsg2 { + width: 200px; +} +</style> + +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/qualityManager/processCheckItem.vue b/src/views/qualityManager/processCheckItem.vue index 8b986e9..22ce180 100644 --- a/src/views/qualityManager/processCheckItem.vue +++ b/src/views/qualityManager/processCheckItem.vue @@ -1,406 +1,411 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>--> - </div> - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex" - > - <div class="elForm"> - <el-form-item label="椤圭洰缂栫爜" style=" display: flex;"> - <el-input v-model="form.itemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="椤圭洰鍚嶇О" style=" display: flex;"> - <el-input v-model="form.itemname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="椤圭洰鎻忚堪" style=" display: flex;"> - <el-input v-model="form.itemdescr" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - /> - </div> - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - :height="tableHeight+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getStepCheckItemSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="椤圭洰缂栫爜" prop="checkitemcode"> - <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="椤圭洰鍚嶇О" prop="checkitemname"> - <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> - </el-form-item> - - <el-form-item label="椤圭洰鎻忚堪" prop="checkitemdescr"> - <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateStepCheckItem, DeleteStepCheckItem, StepCheckItemSearch } from '@/api/QualityManagement' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PrentOrganization } from '@/api/GeneralBasicData' - -export default { - name: 'ProcessCheckItem', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - itemcode: '', // 椤圭洰浠g爜 - itemname: '', // 椤圭洰鍚嶇О - itemdescr: '', // 椤圭洰鎻忚堪 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯浠g爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'org_code', - label: '鎵�灞炶溅闂寸紪鐮�', - id: 5, - show: false, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'org_name', - label: '鎵�灞炶溅闂�', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'descr', - label: '鏍囧噯鎻忚堪', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - checkitemcode: '', // 宸ュ簭妫�楠岄」鐩紪鐮� - checkitemname: '', // 宸ュ簭妫�楠岄」鐩悕绉� - checkitemdescr: '' // 宸ュ簭妫�楠岄」鐩弿杩� - }, - operation: '', - dialogFormRules: { - checkitemcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - checkitemname: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ], - workshopcode: [ - { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] } - ] - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getStepCheckItemSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getStepCheckItemSearch() { - const res = await StepCheckItemSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getStepCheckItemSearch() - }, - // 鏌ヨ - search() { - this.getStepCheckItemSearch() - }, - upload() { - - }, - // 閲嶇疆 - reset() { - this.form.itemcode = '' - this.form.itemname = '' - this.form.itemdescr = '' - this.getStepCheckItemSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.checkitemcode = row.code - this.dialogForm.checkitemname = row.name - this.dialogForm.workshopcode = row.org_code - this.dialogForm.checkitemdescr = row.descr - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteStepCheckItem({ checkitemcode: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getStepCheckItemSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.checkitemcode = '' - this.dialogForm.checkitemname = '' - this.dialogForm.checkitemdescr = '' - this.dialogForm.workshopcode = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const data = { - checkitemcode: this.dialogForm.checkitemcode, - checkitemname: this.dialogForm.checkitemname, - checkitemdescr: this.dialogForm.checkitemdescr, - wkshopcode: this.dialogForm.workshopcode, - OperType: this.operation === 'add' ? 'Add' : 'Update' - } - AddUpdateStepCheckItem(data).then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getStepCheckItemSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - this.$refs.tableDataRef.doLayout() - // if (window.innerHeight < 769) { - // this.tableHeight = this.tableHeight - 50 - // } - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>--> + </div> + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex" + > + <div class="elForm"> + <el-form-item label="椤圭洰缂栫爜" style=" display: flex;"> + <el-input v-model="form.itemcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="椤圭洰鍚嶇О" style=" display: flex;"> + <el-input v-model="form.itemname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="椤圭洰鎻忚堪" style=" display: flex;"> + <el-input v-model="form.itemdescr" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + /> + </div> + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + :height="tableHeight+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getStepCheckItemSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="椤圭洰缂栫爜" prop="checkitemcode"> + <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="椤圭洰鍚嶇О" prop="checkitemname"> + <el-input v-model="dialogForm.checkitemname" style="width: 200px" /> + </el-form-item> + + <el-form-item label="椤圭洰鎻忚堪" prop="checkitemdescr"> + <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateStepCheckItem, DeleteStepCheckItem, StepCheckItemSearch } from '@/api/QualityManagement' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PrentOrganization } from '@/api/GeneralBasicData' + +export default { + name: 'ProcessCheckItem', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + itemcode: '', // 椤圭洰浠g爜 + itemname: '', // 椤圭洰鍚嶇О + itemdescr: '', // 椤圭洰鎻忚堪 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯浠g爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'org_code', + label: '鎵�灞炶溅闂寸紪鐮�', + id: 5, + show: false, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'org_name', + label: '鎵�灞炶溅闂�', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'descr', + label: '鏍囧噯鎻忚堪', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + checkitemcode: '', // 宸ュ簭妫�楠岄」鐩紪鐮� + checkitemname: '', // 宸ュ簭妫�楠岄」鐩悕绉� + checkitemdescr: '' // 宸ュ簭妫�楠岄」鐩弿杩� + }, + operation: '', + dialogFormRules: { + checkitemcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + checkitemname: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ], + workshopcode: [ + { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] } + ] + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getStepCheckItemSearch() + }, + created() { + this.getStepCheckItemSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getStepCheckItemSearch() { + const res = await StepCheckItemSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getStepCheckItemSearch() + }, + // 鏌ヨ + search() { + this.getStepCheckItemSearch() + }, + upload() { + + }, + // 閲嶇疆 + reset() { + this.form.itemcode = '' + this.form.itemname = '' + this.form.itemdescr = '' + this.getStepCheckItemSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.checkitemcode = row.code + this.dialogForm.checkitemname = row.name + this.dialogForm.workshopcode = row.org_code + this.dialogForm.checkitemdescr = row.descr + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteStepCheckItem({ checkitemcode: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getStepCheckItemSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.checkitemcode = '' + this.dialogForm.checkitemname = '' + this.dialogForm.checkitemdescr = '' + this.dialogForm.workshopcode = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const data = { + checkitemcode: this.dialogForm.checkitemcode, + checkitemname: this.dialogForm.checkitemname, + checkitemdescr: this.dialogForm.checkitemdescr, + wkshopcode: this.dialogForm.workshopcode, + OperType: this.operation === 'add' ? 'Add' : 'Update' + } + AddUpdateStepCheckItem(data).then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getStepCheckItemSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + this.$refs.tableDataRef.doLayout() + // if (window.innerHeight < 769) { + // this.tableHeight = this.tableHeight - 50 + // } + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> diff --git a/src/views/qualityManager/processCheckRecord.vue b/src/views/qualityManager/processCheckRecord.vue index b0439af..7accab2 100644 --- a/src/views/qualityManager/processCheckRecord.vue +++ b/src/views/qualityManager/processCheckRecord.vue @@ -1,731 +1,736 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> - <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.partapec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.standname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="妫�楠岀被鍨�" style=" display: flex;"> - <el-select v-model="form.checktype" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checktypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="妫�楠岀粨鏋�" style=" display: flex;"> - <el-select v-model="form.checkresult " style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checkresultArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - :key="tableTimeStampKey" - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='check_type'"> - {{ checktypeArr.find(i=>i.code===row[item.prop]).name }} - </div> - <div v-else-if="item.prop==='check_result'"> - <div v-if="row.check_result==='NG'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 涓嶈壇 - </div> - <div v-if="row.check_result==='OK'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鍚堟牸 - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <!-- <el-button v-waves type="text" @click="check(row)">鏌ョ湅</el-button>--> - <!-- <el-button v-waves type="text" @click="del(row)">鍒犻櫎</el-button>--> - - <el-tooltip class="item" effect="dark" content="鏌ョ湅" placement="top"> - <i - class="el-icon-view" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px;" - @click="check(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="prev, pager, next,sizes,jumper" - popper-class="select_bottom" - @pagination="getStepCheckTableSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="宸ュ簭妫�楠屾槑缁�" - :visible.sync="dialogVisible" - width="1100px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div class="elTableDiv"> - <el-table - ref="tableDataRef2" - :data="tableDataDialog" - :height="(tableHeight-100)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-100)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <!-- <el-table-column--> - <!-- type="selection"--> - <!-- width="50"--> - <!-- fixed--> - <!-- />--> - <el-table-column - type="index" - width="50" - label="搴忓彿" - fixed - /> - - <!-- <el-table-column--> - <!-- prop="checkitem_code"--> - <!-- show-tooltip-when-overflow--> - <!-- label="妫�楠岄」鐩紪鍙�"--> - <!-- width="120"--> - <!-- />--> - <el-table-column - prop="checkitem_name" - label="妫�楠岄」鐩�" - fixed - show-tooltip-when-overflow - /> - <!-- <el-table-column--> - <!-- prop="checkitem_descr"--> - <!-- label="妫�楠岄」鐩弿杩�"--> - <!-- show-tooltip-when-overflow--> - <!-- />--> - <el-table-column - prop="standvalue" - label="鏍囧噯瑕佹眰" - fixed - min-width="120" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <!-- ~褰撲笁涓�奸兘鏈� --> - <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue">{{ row.standvalue }}({{ - row.lowervalue - }}~{{ row.uppervalue }}) - </div> - <!-- ~褰撳彧鏈夋爣鍑嗗�煎拰涓婇檺鍊兼椂 --> - <div v-else-if="row.standvalue&&row.uppervalue">{{ row.standvalue }}(~{{ row.uppervalue }})</div> - <!-- ~褰撳彧鏈夋爣鍑嗗�煎拰涓嬮檺鍊兼椂--> - <div v-else-if="row.standvalue&&row.lowervalue">{{ row.standvalue }}({{ row.lowervalue }}~)</div> - - <!-- ~褰撳彧鏈変笂闄愬�煎拰涓嬮檺鍊兼椂--> - <div v-else-if="row.uppervalue&&row.lowervalue">({{ row.lowervalue }}~{{ row.uppervalue }})</div> - <!-- ~褰撳彧鏈夋爣鍑嗗�兼椂 --> - <div v-else-if="row.standvalue">{{ row.standvalue }}</div> - <!-- ~褰撳彧鏈変笂闄愬�兼椂 --> - <div v-else-if="row.uppervalue">(~{{ row.uppervalue }})</div> - <!-- ~褰撳彧鏈変笅闄愬�兼椂 --> - <div v-else-if="row.lowervalue">({{ row.lowervalue }}~)</div> - - <div v-else>/</div> - - </template> - </el-table-column> - - <el-table-column - v-for="(item,index) in dialogTableArrayCol" - :key="item" - :prop="(index+1)+'/'+ dialogTableNumberCol" - :label="'绗�'+(index+1)+'浠�'" - show-tooltip-when-overflow - min-width="100" - > - <template slot-scope="{row}"> - <div style="display: flex;align-items: center"> - <i - :class="row[(index + 1) + '/' + dialogTableNumberCol].split('_')[1]==='OK'?'el-icon-success':'el-icon-error'" - :style="{color:row[(index + 1) + '/' + dialogTableNumberCol].split('_')[1]==='OK'?$store.state.settings.theme:'red'}" - style="margin-right: 2px" - /> - {{ row[(index + 1) + '/' + dialogTableNumberCol].split('_')[0] }} - </div> - - <!-- <!– ~褰撲笁涓�奸兘鏈� –>--> - <!-- <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> - <!-- <!– <div v-if="row[(index + 1) + '/' + dialogTableNumberCol]>=row.lowervalue&&row[(index + 1) + '/' + dialogTableNumberCol]<=row.uppervalue">–>--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - - <!-- <!– ~褰撳彧鏈夋爣鍑嗗�煎拰涓婇檺鍊兼椂 –>--> - <!-- <div v-else-if="row.standvalue&&row.uppervalue&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - <!-- <!– ~褰撳彧鏈夋爣鍑嗗�煎拰涓嬮檺鍊兼椂–>--> - <!-- <div v-else-if="row.standvalue&&row.lowervalue&&row.uppervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - - <!-- <!– ~褰撳彧鏈変笂闄愬�煎拰涓嬮檺鍊兼椂–>--> - <!-- <div v-else-if="row.uppervalue&&row.lowervalue&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - <!-- <!– ~褰撳彧鏈夋爣鍑嗗�兼椂 –>--> - <!-- <div v-else-if="row.standvalue&&row.uppervalue===''&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])===parseFloat(row.standvalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - <!-- <!– ~褰撳彧鏈変笂闄愬�兼椂 –>--> - <!-- <div v-else-if="row.uppervalue&&row.lowervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - - <!-- <!– ~褰撳彧鏈変笅闄愬�兼椂 –>--> - <!-- <div v-else-if="row.lowervalue&& row.uppervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div></div>--> - - <!-- <div v-else>--> - <!-- <div style="display: flex;align-items: center">--> - <!-- <i class="el-icon-error" style="color: red;margin-right: 2px" />--> - <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> - <!-- </div>--> - <!-- </div>--> - - </template> - </el-table-column> - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - <el-button v-waves @click="dialogVisibleBack">杩� 鍥�</el-button> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { StepCheckTableOutExcel, StepCheckTableSearch, StepCheckTableSubSearch } from '@/api/QualityManagement' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -const SER_HZ = /^[\u4e00-\u9fa5]+$/ -export default { - name: 'ProcessCheckRecord', - components: { - Pagination, ImportPicker, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partapec: '', // 浜у搧瑙勬牸 - stepname: '', // 宸ュ簭鍚嶇О - standname: '', // 鏍囧噯鍚嶇О - checktype: '', // 妫�楠岀被鍨� - checkresult: '', // 妫�楠岀被鍨� - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checktypeArr: [ - { code: 'InCheck', name: '鍏ュ巶妫�楠�' }, - { code: 'OutCheck', name: '鍑哄巶妫�楠�' }, - { code: 'FirstCheck', name: '棣栨' }, - { code: 'PatroCheck', name: '宸℃' }, - { code: 'EndCheck', name: '瀹屽伐妫�' } - ], - checkresultArr: [ - { code: 'OK', name: '鍚堟牸' }, - { code: 'NG', name: '涓嶈壇' } - ], - - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 160, - width: false, - prop: 'wo_code', - label: '宸ュ崟缂栧彿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'partcode', - label: '浜у搧缂栫爜', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'partname', - label: '浜у搧鍚嶇О', - id: 5, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'partspec', - label: '浜у搧瑙勬牸', - id: 6, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'step_code', - label: '宸ュ簭缂栫爜', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'stepname', - label: '宸ュ簭鍚嶇О', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'checkstaned_code', - label: '鏍囧噯缂栫爜', - id: 9, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'checkstaned_name', - label: '鏍囧噯鍚嶇О', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'check_type', - label: '妫�楠岀被鍨�', - id: 11, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'check_result', - label: '妫�楠岀粨鏋�', - id: 12, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'check_descr', - label: '妫�楠屽娉�', - id: 13, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'check_qty', - label: '妫�楠屾暟閲�', - id: 14, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'lm_user', - label: '妫�楠屼汉鍛�', - id: 15, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 160, - width: false, - prop: 'lm_date', - label: '妫�楠屾椂闂�', - id: 16, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - tableDataDialog: [], - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false, - dialogTableNumberCol: 0, // 瀵硅瘽妗嗗姩鎬佺殑鍒楁暟 - dialogTableArrayCol: []// 瀵硅瘽妗嗗姩鎬佺殑鏁扮粍 - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getStepCheckTableSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getStepCheckTableSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - async getStepCheckTableSearch() { - const res = await StepCheckTableSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getStepCheckTableSearch() - }, - // 鏌ヨ - search() { - this.getStepCheckTableSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wocode = '', // 宸ュ崟缂栧彿 - this.form.partcode = '', // 浜у搧缂栫爜 - this.form.partname = '', // 浜у搧鍚嶇О - this.form.partapec = '', // 浜у搧瑙勬牸 - this.form.stepname = '', // 宸ュ簭鍚嶇О - this.form.standname = '', // 鏍囧噯鍚嶇О - this.form.checktype = '', // 妫�楠岀被鍨� - this.form.checkresult = '', // 妫�楠岀被鍨� - this.getStepCheckTableSearch() - }, - - async check(row) { - // this.operation = operation - - this.dialogVisible = true - console.log(row, 1) - const res = await StepCheckTableSubSearch({ id: row.id }) - this.tableDataDialog = res.data - - this.tableDataDialog.forEach((item, index) => { - for (const it in item) { - if (it.indexOf('/') !== -1) { - const i = it.split('/')[1] - this.dialogTableNumberCol = i - } - } - }) - - this.dialogTableArrayCol = [] - for (let i = 0; i < this.dialogTableNumberCol; i++) { - this.dialogTableArrayCol.push(i) - } - - this.$nextTick(() => { - this.$refs.tableDataRef2.doLayout() - }) - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.OrgCode = row.org_code - this.dialogForm.OrgName = row.org_name - this.dialogForm.SupUnit = row.parent_id - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteOrganization({ orgid: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getStepCheckTableSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.tableDataDialog = [] - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - AddUpdateOrganization(data).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getStepCheckTableSearch() - } else { - this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 250 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - async download() { - const { data: res } = await StepCheckTableOutExcel(this.form) - window.location.href = res - }, - dialogVisibleBack() { - this.dialogVisible = false - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + <!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>--> + <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.partapec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.standname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="妫�楠岀被鍨�" style=" display: flex;"> + <el-select v-model="form.checktype" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checktypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="妫�楠岀粨鏋�" style=" display: flex;"> + <el-select v-model="form.checkresult " style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checkresultArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"> + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + :key="tableTimeStampKey" + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='check_type'"> + {{ checktypeArr.find(i=>i.code===row[item.prop]).name }} + </div> + <div v-else-if="item.prop==='check_result'"> + <div v-if="row.check_result==='NG'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 涓嶈壇 + </div> + <div v-if="row.check_result==='OK'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鍚堟牸 + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <!-- <el-button v-waves type="text" @click="check(row)">鏌ョ湅</el-button>--> + <!-- <el-button v-waves type="text" @click="del(row)">鍒犻櫎</el-button>--> + + <el-tooltip class="item" effect="dark" content="鏌ョ湅" placement="top"> + <i + class="el-icon-view" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px;" + @click="check(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="prev, pager, next,sizes,jumper" + popper-class="select_bottom" + @pagination="getStepCheckTableSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="宸ュ簭妫�楠屾槑缁�" + :visible.sync="dialogVisible" + width="1100px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div class="elTableDiv"> + <el-table + ref="tableDataRef2" + :data="tableDataDialog" + :height="(tableHeight-100)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-100)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <!-- <el-table-column--> + <!-- type="selection"--> + <!-- width="50"--> + <!-- fixed--> + <!-- />--> + <el-table-column + type="index" + width="50" + label="搴忓彿" + fixed + /> + + <!-- <el-table-column--> + <!-- prop="checkitem_code"--> + <!-- show-tooltip-when-overflow--> + <!-- label="妫�楠岄」鐩紪鍙�"--> + <!-- width="120"--> + <!-- />--> + <el-table-column + prop="checkitem_name" + label="妫�楠岄」鐩�" + fixed + show-tooltip-when-overflow + /> + <!-- <el-table-column--> + <!-- prop="checkitem_descr"--> + <!-- label="妫�楠岄」鐩弿杩�"--> + <!-- show-tooltip-when-overflow--> + <!-- />--> + <el-table-column + prop="standvalue" + label="鏍囧噯瑕佹眰" + fixed + min-width="120" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <!-- ~褰撲笁涓�奸兘鏈� --> + <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue">{{ row.standvalue }}({{ + row.lowervalue + }}~{{ row.uppervalue }}) + </div> + <!-- ~褰撳彧鏈夋爣鍑嗗�煎拰涓婇檺鍊兼椂 --> + <div v-else-if="row.standvalue&&row.uppervalue">{{ row.standvalue }}(~{{ row.uppervalue }})</div> + <!-- ~褰撳彧鏈夋爣鍑嗗�煎拰涓嬮檺鍊兼椂--> + <div v-else-if="row.standvalue&&row.lowervalue">{{ row.standvalue }}({{ row.lowervalue }}~)</div> + + <!-- ~褰撳彧鏈変笂闄愬�煎拰涓嬮檺鍊兼椂--> + <div v-else-if="row.uppervalue&&row.lowervalue">({{ row.lowervalue }}~{{ row.uppervalue }})</div> + <!-- ~褰撳彧鏈夋爣鍑嗗�兼椂 --> + <div v-else-if="row.standvalue">{{ row.standvalue }}</div> + <!-- ~褰撳彧鏈変笂闄愬�兼椂 --> + <div v-else-if="row.uppervalue">(~{{ row.uppervalue }})</div> + <!-- ~褰撳彧鏈変笅闄愬�兼椂 --> + <div v-else-if="row.lowervalue">({{ row.lowervalue }}~)</div> + + <div v-else>/</div> + + </template> + </el-table-column> + + <el-table-column + v-for="(item,index) in dialogTableArrayCol" + :key="item" + :prop="(index+1)+'/'+ dialogTableNumberCol" + :label="'绗�'+(index+1)+'浠�'" + show-tooltip-when-overflow + min-width="100" + > + <template slot-scope="{row}"> + <div style="display: flex;align-items: center"> + <i + :class="row[(index + 1) + '/' + dialogTableNumberCol].split('_')[1]==='OK'?'el-icon-success':'el-icon-error'" + :style="{color:row[(index + 1) + '/' + dialogTableNumberCol].split('_')[1]==='OK'?$store.state.settings.theme:'red'}" + style="margin-right: 2px" + /> + {{ row[(index + 1) + '/' + dialogTableNumberCol].split('_')[0] }} + </div> + + <!-- <!– ~褰撲笁涓�奸兘鏈� –>--> + <!-- <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> + <!-- <!– <div v-if="row[(index + 1) + '/' + dialogTableNumberCol]>=row.lowervalue&&row[(index + 1) + '/' + dialogTableNumberCol]<=row.uppervalue">–>--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + + <!-- <!– ~褰撳彧鏈夋爣鍑嗗�煎拰涓婇檺鍊兼椂 –>--> + <!-- <div v-else-if="row.standvalue&&row.uppervalue&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + <!-- <!– ~褰撳彧鏈夋爣鍑嗗�煎拰涓嬮檺鍊兼椂–>--> + <!-- <div v-else-if="row.standvalue&&row.lowervalue&&row.uppervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + + <!-- <!– ~褰撳彧鏈変笂闄愬�煎拰涓嬮檺鍊兼椂–>--> + <!-- <div v-else-if="row.uppervalue&&row.lowervalue&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + <!-- <!– ~褰撳彧鏈夋爣鍑嗗�兼椂 –>--> + <!-- <div v-else-if="row.standvalue&&row.uppervalue===''&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])===parseFloat(row.standvalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + <!-- <!– ~褰撳彧鏈変笂闄愬�兼椂 –>--> + <!-- <div v-else-if="row.uppervalue&&row.lowervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + + <!-- <!– ~褰撳彧鏈変笅闄愬�兼椂 –>--> + <!-- <div v-else-if="row.lowervalue&& row.uppervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div></div>--> + + <!-- <div v-else>--> + <!-- <div style="display: flex;align-items: center">--> + <!-- <i class="el-icon-error" style="color: red;margin-right: 2px" />--> + <!-- {{ row[(index + 1) + '/' + dialogTableNumberCol] }}--> + <!-- </div>--> + <!-- </div>--> + + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + <el-button v-waves @click="dialogVisibleBack">杩� 鍥�</el-button> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AddUpdateOrganization, DeleteOrganization } from '@/api/basicSettings' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { StepCheckTableOutExcel, StepCheckTableSearch, StepCheckTableSubSearch } from '@/api/QualityManagement' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +const SER_HZ = /^[\u4e00-\u9fa5]+$/ +export default { + name: 'ProcessCheckRecord', + components: { + Pagination, ImportPicker, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partapec: '', // 浜у搧瑙勬牸 + stepname: '', // 宸ュ簭鍚嶇О + standname: '', // 鏍囧噯鍚嶇О + checktype: '', // 妫�楠岀被鍨� + checkresult: '', // 妫�楠岀被鍨� + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checktypeArr: [ + { code: 'InCheck', name: '鍏ュ巶妫�楠�' }, + { code: 'OutCheck', name: '鍑哄巶妫�楠�' }, + { code: 'FirstCheck', name: '棣栨' }, + { code: 'PatroCheck', name: '宸℃' }, + { code: 'EndCheck', name: '瀹屽伐妫�' } + ], + checkresultArr: [ + { code: 'OK', name: '鍚堟牸' }, + { code: 'NG', name: '涓嶈壇' } + ], + + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 160, + width: false, + prop: 'wo_code', + label: '宸ュ崟缂栧彿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'partcode', + label: '浜у搧缂栫爜', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'partname', + label: '浜у搧鍚嶇О', + id: 5, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'partspec', + label: '浜у搧瑙勬牸', + id: 6, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'step_code', + label: '宸ュ簭缂栫爜', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'stepname', + label: '宸ュ簭鍚嶇О', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'checkstaned_code', + label: '鏍囧噯缂栫爜', + id: 9, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'checkstaned_name', + label: '鏍囧噯鍚嶇О', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'check_type', + label: '妫�楠岀被鍨�', + id: 11, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'check_result', + label: '妫�楠岀粨鏋�', + id: 12, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'check_descr', + label: '妫�楠屽娉�', + id: 13, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'check_qty', + label: '妫�楠屾暟閲�', + id: 14, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'lm_user', + label: '妫�楠屼汉鍛�', + id: 15, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 160, + width: false, + prop: 'lm_date', + label: '妫�楠屾椂闂�', + id: 16, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + tableDataDialog: [], + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false, + dialogTableNumberCol: 0, // 瀵硅瘽妗嗗姩鎬佺殑鍒楁暟 + dialogTableArrayCol: []// 瀵硅瘽妗嗗姩鎬佺殑鏁扮粍 + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getStepCheckTableSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getStepCheckTableSearch() + }, + created() { + this.getStepCheckTableSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + async getStepCheckTableSearch() { + const res = await StepCheckTableSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getStepCheckTableSearch() + }, + // 鏌ヨ + search() { + this.getStepCheckTableSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wocode = '', // 宸ュ崟缂栧彿 + this.form.partcode = '', // 浜у搧缂栫爜 + this.form.partname = '', // 浜у搧鍚嶇О + this.form.partapec = '', // 浜у搧瑙勬牸 + this.form.stepname = '', // 宸ュ簭鍚嶇О + this.form.standname = '', // 鏍囧噯鍚嶇О + this.form.checktype = '', // 妫�楠岀被鍨� + this.form.checkresult = '', // 妫�楠岀被鍨� + this.getStepCheckTableSearch() + }, + + async check(row) { + // this.operation = operation + + this.dialogVisible = true + console.log(row, 1) + const res = await StepCheckTableSubSearch({ id: row.id }) + this.tableDataDialog = res.data + + this.tableDataDialog.forEach((item, index) => { + for (const it in item) { + if (it.indexOf('/') !== -1) { + const i = it.split('/')[1] + this.dialogTableNumberCol = i + } + } + }) + + this.dialogTableArrayCol = [] + for (let i = 0; i < this.dialogTableNumberCol; i++) { + this.dialogTableArrayCol.push(i) + } + + this.$nextTick(() => { + this.$refs.tableDataRef2.doLayout() + }) + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.OrgCode = row.org_code + this.dialogForm.OrgName = row.org_name + this.dialogForm.SupUnit = row.parent_id + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteOrganization({ orgid: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getStepCheckTableSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.tableDataDialog = [] + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + AddUpdateOrganization(data).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getStepCheckTableSearch() + } else { + this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 250 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + async download() { + const { data: res } = await StepCheckTableOutExcel(this.form) + window.location.href = res + }, + dialogVisibleBack() { + this.dialogVisible = false + } + } +} +</script> diff --git a/src/views/qualityManager/qualityPlaning.vue b/src/views/qualityManager/qualityPlaning.vue index 9d77b54..2979426 100644 --- a/src/views/qualityManager/qualityPlaning.vue +++ b/src/views/qualityManager/qualityPlaning.vue @@ -1,1295 +1,1300 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="璐ㄦ鏂规缂栫爜" style=" display: flex;"> - <el-input v-model="form.qualityinsptcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="璐ㄦ鏂规鍚嶇О" style=" display: flex;"> - <el-input v-model="form.qualityinsptname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏈夋晥鐘舵��" style=" display: flex;"> - <el-select v-model="form.status" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in whetherOrNot" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="璐ㄦ绫诲瀷" style=" display: flex;"> - <el-select v-model="form.checktype" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checktypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶芥牱鏂瑰紡" style=" display: flex;"> - <el-select v-model="form.sampltype" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in sampltypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="閫傜敤瀵硅薄" style=" display: flex;"> - <el-select v-model="form.suitobject" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in suitobjectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - :key="tableTimeStampKey" - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <!-- <el-table-column--> - <!-- prop="RowNum"--> - <!-- width="50"--> - <!-- fixed--> - <!-- label="搴忓彿"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="code"--> - <!-- label="璐ㄦ鏂规缂栫爜"--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="name"--> - <!-- label="璐ㄦ鏂规鍚嶇О"--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="status"--> - <!-- label="鏈夋晥鐘舵��"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.status==='Y'"><i--> - <!-- class="el-icon-success"--> - <!-- :style="{color:$store.state.settings.theme}"--> - <!-- style="margin-right:5px"--> - <!-- />鏄�--> - <!-- </div>--> - <!-- <div v-else-if="row.status==='N'"><i class="el-icon-info" style="margin-right: 5px" />鍚�</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="checktype"--> - <!-- label="璐ㄦ绫诲瀷"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.checktype">{{ checktypeArr.find(i => i.code === row.checktype).name }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="sampmethod"--> - <!-- label="鎶芥牱鏂瑰紡"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.sampmethod">{{ sampltypeArr.find(i => i.code === row.sampmethod).name }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="suitobject"--> - <!-- label="閫傜敤瀵硅薄"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.suitobject">{{ suitobjectArr.find(i => i.code === row.suitobject).name }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - - <!-- <el-table-column--> - <!-- prop="username"--> - <!-- label="鍒涘缓浜哄憳"--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="lm_date"--> - <!-- label="鍒涘缓鏃堕棿"--> - <!-- width="160"--> - <!-- sortable="custom"--> - <!-- />--> - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='checktype'"> - {{ checktypeArr.find(i => i.code === row[item.prop]).name }} - </div> - <div v-else-if="item.prop==='sampmethod'"> - {{ sampltypeArr.find(i => i.code === row[item.prop]).name }} - </div> - <!-- 閫傜敤瀵硅薄--> - <div v-else-if="item.prop==='suitobject'"> - {{ suitobjectArr.find(i => i.code === row.suitobject).name }} - </div> - <div v-else-if="item.prop==='status'"> - <div v-if="row.status==='Y'"><i - class="el-icon-success" - :style="{color:$store.state.settings.theme}" - style="margin-right:5px" - />鏄� - </div> - <div v-else-if="row.status==='N'"><i class="el-icon-info" style="margin-right: 5px" />鍚�</div> - <div v-else>/</div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="鏌ョ湅" placement="top"> - <i - class="el-icon-view" - :style="{color:$store.state.settings.theme}" - style="margin-right:15px;cursor: pointer;" - @click="check('check',row)" - /> - </el-tooltip> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getQualityInspectionSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':operation==='check'?'鏌ョ湅':'缂栬緫'" - :visible.sync="dialogVisible" - width="1260px" - :close-on-click-modal="false" - top="5vh" - @closed="handleClose" - @close="handleClose" - > - - <!-- <div>--> - <!-- <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />鍩虹璧勬枡锛�--> - <!-- </div>--> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> - <el-form-item label="璐ㄦ鏂规缂栫爜" prop="qualityinsptcode"> - <el-input v-model="dialogForm.qualityinsptcode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="璐ㄦ鏂规鍚嶇О" prop="qualityinsptname"> - <el-input v-model="dialogForm.qualityinsptname" style="width: 200px" /> - </el-form-item> - <br> - <el-form-item prop="status" label="鏈夋晥鐘舵��"> - <el-select - v-model="dialogForm.status" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in whetherOrNot" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <br> - <el-form-item prop="checktype" label="璐ㄦ绫诲瀷"> - <el-radio-group v-model="dialogForm.checktype"> - <!-- <el-radio label="InCheck">鍏ュ巶妫�楠�</el-radio>--> - <!-- <el-radio label="OutCheck">鍑哄巶妫�楠�</el-radio>--> - <el-radio label="FirstCheck">棣栨妫�楠�</el-radio> - <el-radio label="PatroCheck">宸℃</el-radio> - <el-radio label="EndCheck">瀹屽伐妫�</el-radio> - </el-radio-group> - </el-form-item> - <br> - <el-form-item prop="sampmethod" label="鎶芥牱鏂瑰紡"> - <el-radio-group v-model="dialogForm.sampmethod" style="width: 200px;"> - <el-radio label="FIXED">鍥烘椂鎶芥</el-radio> - <el-radio label="SCARE">姣斾緥鎶芥</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item v-if="dialogForm.sampmethod==='FIXED'" label="鏍锋湰鏁伴噺" prop="sampnum"> - <el-input v-model="dialogForm.sampnum" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - <el-form-item v-if="dialogForm.sampmethod==='SCARE'" label="鎶芥姣斾緥" prop="sampscale"> - <el-input v-model="dialogForm.sampscale" oninput="value=value.replace(/[^0-9.]/g,'')" style="width: 180px" /> - % - </el-form-item> - <br> - <el-form-item prop="suitobject" label="閫傜敤瀵硅薄"> - <el-radio-group v-model="dialogForm.suitobject" style="width: 200px;" @change="suitobjectChange"> - <el-radio label="PY">鐗╂枡绫诲埆</el-radio> - <el-radio label="P">鐗╂枡</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item - prop="suitpart" - :label="dialogForm.suitobject==='P'?'閫傜敤鐗╂枡':'閫傜敤鐗╂枡绫诲埆'" - > - <el-select - v-model="dialogForm.suitpart" - style="width: 200px" - multiple - filterable - collapse-tags - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in PartSelectArr" - v-if="dialogForm.suitobject==='P'" - :key="item.partcode" - :label="item.partcode +' / '+ item.partname" - :value="item.partcode" - /> - <el-option - v-for="item in StockTypeSelectArr" - v-if="dialogForm.suitobject==='PY'" - :key="item.code" - :label="item.code+' / '+item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <br> - <el-form-item - label="宸ュ簭鍚嶇О" - prop="stepcode" - > - <el-select - v-model="dialogForm.stepcode" - style="width: 200px" - filterable - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in StepSelectArr" - :key="item.stepcode" - :label="item.stepname" - :value="item.stepcode" - /> - </el-select> - </el-form-item> - - <el-form-item label="妫�楠屾柟妗堟弿杩�"> - <el-input v-model="dialogForm.descr" type="textarea" :autosize="{ minRows: 2 }" /> - </el-form-item> - </el-form> - - <div style="display: flex;align-items: center;margin-bottom: 10px;"> - <div> - <i - class="el-icon-s-operation" - :style="{color:$store.state.settings.theme}" - style="margin:0 10px 0 0px;" - /> - </div> - <div>璐ㄦ鍒楄〃锛�</div> - <el-button - v-if="operation!=='check'" - v-waves - type="primary" - style="margin-left: 20px;" - icon="el-icon-circle-plus-outline" - @click="addZjlb" - >鏂板 - </el-button> - </div> - - <el-table - ref="tableDataRef2" - class="tableFixed" - :data="checkitem" - height="250" - style="height:250px" - border - :row-class-name="tableRowClassName" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - fixed - label="搴忓彿" - /> - <!-- <el-table-column--> - <!-- prop="jyxmbm"--> - <!-- width="105"--> - <!-- label="妫�楠岄」鐩紪鐮�"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <el-select--> - <!-- v-if="row.isVisible===1"--> - <!-- v-model="row.jyxmbm"--> - <!-- filterable--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- @change="val=>tableChange(val,row)"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in PartSelectArr"--> - <!-- :key="item.partname"--> - <!-- :label="item.partcode"--> - <!-- :value="item.partname"--> - <!-- />--> - <!-- </el-select>--> - <!-- <div v-if="row.isVisible===0">{{ row.jyxmbm }}</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <!-- <el-table-column--> - <!-- prop="jyxmmc"--> - <!-- width="105"--> - <!-- label="妫�楠岄」鐩悕绉�"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <el-select--> - <!-- v-if="row.isVisible===1"--> - <!-- v-model="row.jyxmmc"--> - <!-- filterable--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- @change="val=>tableChange(val,row)"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in PartSelectArr"--> - <!-- :key="item.partname"--> - <!-- :label="item.partcode"--> - <!-- :value="item.partname"--> - <!-- />--> - <!-- </el-select>--> - <!-- <div v-if="row.isVisible===0">{{ row.jyxmmc }}</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - - <el-table-column - prop="stepcheckitem_code" - width="250" - label="妫�楠岄」鐩� / 缂栫爜" - > - <template slot-scope="{row}"> - <el-select - v-if="row.isVisible===1" - v-model="row.stepcheckitem_code" - filterable - placeholder="璇烽�夋嫨" - style="width: 100%;" - > - <!-- @change="val=>tableChange(val,row)"--> - <el-option - v-for="item in CheckItemSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - <div v-else>{{ - CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code).name - }} - </div> - </template> - </el-table-column> - - <el-table-column - prop="required" - width="85" - label="鏄惁蹇呭~" - > - <template slot-scope="{row}"> - <el-select - v-if="row.isVisible===1" - v-model="row.required" - filterable - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in whetherOrNot" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - <div v-else>{{ row.required === 'Y' ? '鏄�' : '鍚�' }}</div> - </template> - </el-table-column> - <el-table-column - prop="numberjudge" - width="85" - label="鏁板�煎垽瀹�" - > - <template slot-scope="{row}"> - <el-select - v-if="row.isVisible===1" - v-model="row.numberjudge" - filterable - placeholder="璇烽�夋嫨" - @change="val=>szpdChange(val,row)" - > - <el-option - v-for="item in whetherOrNot" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - <div v-else>{{ row.numberjudge === 'Y' ? '鏄�' : '鍚�' }}</div> - </template> - </el-table-column> - <el-table-column - prop="unit" - label="鍗曚綅" - > - <template slot-scope="{row}"> - <!-- <el-select--> - <!-- v-if="row.isVisible===1"--> - <!-- v-model="row.unit"--> - <!-- filterable--> - <!-- :disabled="row.numberjudge==='N'"--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in UomSelectArr"--> - <!-- :key="item.code"--> - <!-- :label="item.name"--> - <!-- :value="item.code"--> - <!-- />--> - <!-- </el-select>--> - <!-- <div v-if="row.isVisible===0">{{--> - <!-- row.numberjudge === 'Y' ? UomSelectArr.find(i => i.code === row.unit).name : '/'--> - <!-- }}--> - <!-- </div>--> - <el-input - v-if="row.isVisible===1" - v-model="row.unit" - placeholder="璇烽�夋嫨" - :disabled="row.numberjudge==='N'" - /> - <div v-else>{{ row.unit ? row.unit : '/' }}</div> - </template> - </el-table-column> - <el-table-column - prop="decimalnum" - width="85" - label="灏忔暟浣嶆暟" - > - <template slot-scope="{row}"> - <!-- <el-select--> - <!-- v-if="row.isVisible===1"--> - <!-- v-model="row.decimalnum"--> - <!-- filterable--> - <!-- placeholder="璇烽�夋嫨"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in PartSelectArr"--> - <!-- :key="item.partname"--> - <!-- :label="item.partcode"--> - <!-- :value="item.partname"--> - <!-- />--> - <!-- </el-select>--> - <el-input - v-if="row.isVisible===1" - v-model="row.decimalnum" - :disabled="row.numberjudge==='N'" - oninput="value=value.replace(/[^0-9]/g,'')" - placeholder="璇疯緭鍏�" - /> - <div v-else>{{ row.numberjudge === 'Y' ? row.decimalnum : '/' }}</div> - </template> - </el-table-column> - <el-table-column - prop="standvalue" - label="鏍囧噯鍊�" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.standvalue" - :disabled="row.numberjudge==='N'" - oninput="value=value.replace(/[^0-9.]/g,'')" - placeholder="璇疯緭鍏�" - /> - <div v-else>{{ row.standvalue ? row.standvalue : '/' }}</div> - </template> - </el-table-column> - <el-table-column - prop="uppervalue" - label="涓婇檺鍊�" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.uppervalue" - :disabled="row.numberjudge==='N'" - oninput="value=value.replace(/[^0-9.]/g,'')" - placeholder="璇疯緭鍏�" - /> - <div v-else>{{ row.uppervalue ? row.uppervalue : '/' }}</div> - </template> - </el-table-column> - <el-table-column - prop="lowervalue" - label="涓嬮檺鍊�" - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.lowervalue" - :disabled="row.numberjudge==='N'" - oninput="value=value.replace(/[^0-9.]/g,'')" - placeholder="璇疯緭鍏�" - /> - <div v-else>{{ row.lowervalue ? row.lowervalue : '/' }}</div> - </template> - </el-table-column> - <el-table-column - prop="stepcheckitem_desc" - label="鎻忚堪" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <el-input - v-if="row.isVisible===1" - v-model="row.stepcheckitem_desc" - placeholder="璇疯緭鍏�" - /> - <div v-else>{{ row.stepcheckitem_desc ? row.stepcheckitem_desc : '/' }}</div> - </template> - </el-table-column> - <el-table-column - v-if="operation!=='check'" - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveZjlbRow(row)">纭</el-button> - <el-button v-if="row.isVisible===1&&isCancel" v-waves type="text" @click="cancelZjlbRow(row)">鍙栨秷 - </el-button> - <el-button v-if="row.isVisible!==1" v-waves type="text" @click="editZjlbRow(row)">缂栬緫</el-button> - <el-button v-if="row.isVisible!==1" v-waves type="text" @click="delZjlbRow(row)">鍒犻櫎</el-button> - </div> - </template> - </el-table-column> - </el-table> - - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-if="operation!=='check'" v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-if="operation!=='check'" - v-waves - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - type="primary" - @click="dialogVisibleConfirm" - >淇� 瀛�</el-button> - <el-button v-if="operation==='check'" v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - QualityInspectionAddEditSave, - QualityInspectionDelete, - QualityInspectionSearch, QualityInspectionSeeEdit, QualityStepCheckItemSelect -} from '@/api/QualityManagement' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PartSelect, TMaterielClassTree } from '@/api/ProductModel' -import { StepData } from '@/api/GeneralBasicData' - -export default { - name: 'QualityPlaning', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - qualityinsptcode: '', // 璐ㄦ鏂规缂栫爜 - qualityinsptname: '', // 璐ㄦ鏂规鍚嶇О - status: '', // 鏈夋晥鐘舵�� - checktype: '', // 璐ㄦ绫诲瀷 - sampltype: '', // 鎶芥牱鏂瑰紡 - suitobject: '', // 閫傜敤瀵硅薄 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checktypeArr: [ - // { code: 'InCheck', name: '鍏ュ巶妫�楠�' }, - // { code: 'OutCheck', name: '鍑哄巶妫�楠�' }, - { code: 'FirstCheck', name: '棣栨' }, - { code: 'PatroCheck', name: '宸℃' }, - { code: 'EndCheck', name: '瀹屽伐妫�' } - ], - sampltypeArr: [ - { code: 'FIXED', name: '鍥哄畾鎶芥' }, - { code: 'SCARE', name: '姣斾緥鎶芥' } - ], - suitobjectArr: [ - { code: 'P', name: '鐗╂枡' }, - { code: 'PY', name: '鐗╂枡绫诲瀷' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 130, - width: false, - prop: 'code', - label: '璐ㄦ鏂规缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 130, - width: false, - prop: 'name', - label: '璐ㄦ鏂规鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'status', - label: '鏈夋晥鐘舵��', - id: 5, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'checktype', - label: '璐ㄦ绫诲瀷', - id: 6, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'sampmethod', - label: '鎶芥牱鏂瑰紡', - id: 7, - show: true, - fixed: false, - sortable: true - }, - - { - minWidth: 110, - width: false, - prop: 'suitobject', - label: '閫傜敤瀵硅薄', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'stepcode', - label: '宸ュ簭缂栫爜', - id: 9, - show: false, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'stepname', - label: '宸ュ簭鍚嶇О', - id: 10, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'username', - label: '鍒涘缓浜哄憳', - id: 11, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 12, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - dialogVisible: false, - dialogForm: { - qualityinsptcode: '', // 璐ㄦ鏂规缂栫爜 - qualityinsptname: '', // 璐ㄦ鏂规鍚嶇О - status: 'Y', // 鏈夋晥鐘舵�� - checktype: 'FirstCheck', // 妫�楠岀被鍨� - sampmethod: 'FIXED', // 鎶芥鏂瑰紡 - sampnum: '', // 鏍锋湰鏁伴噺 - sampscale: '', // 鎶芥姣斾緥 - suitobject: 'P', // 閫傜敤瀵硅薄 - suitpart: [], // 閫傜敤鐗╂枡 - stepcode: '', // 宸ュ簭 - descr: '' // /鎻忚堪 - }, - operation: '', - dialogFormRules: { - status: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - qualityinsptcode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - qualityinsptname: [ - { required: true, message: '璇疯緭鍏ヨ川妫�鏂规鍚嶇О', trigger: ['blur', 'change'] } - ], - checktype: [ - { required: true, message: '璇烽�夋嫨璐ㄦ鏂瑰紡', trigger: ['blur', 'change'] } - ], - sampmethod: [ - { required: true, message: '璇烽�夋嫨鎶芥牱鏂瑰紡', trigger: ['blur', 'change'] } - ], - sampnum: [ - { required: true, message: '璇疯緭鍏ユ牱鏈暟閲�', trigger: ['blur', 'change'] } - ], - sampscale: [ - { required: true, message: '璇疯緭鍏ユ娊妫�姣斾緥', trigger: ['blur', 'change'] } - ], - suitobject: [ - { required: true, message: '璇烽�夋嫨閫傜敤瀵硅薄', trigger: ['blur', 'change'] } - ], - suitpart: [ - { required: true, message: '璇烽�夋嫨鐗╂枡鎴栫墿鏂欑被鍒�', trigger: ['blur', 'change'] } - ], - stepcode: [ - { required: true, message: '璇烽�夋嫨宸ュ簭鍚嶇О', trigger: ['blur', 'change'] } - ] - }, - checkitem: [], - - whetherOrNot: [ // 鏄垨鍚� - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - - PartSelectArr: [], // 鐗╂枡涓嬫媺鏁扮粍 - StockTypeSelectArr: [], // 鐗╂枡绫诲埆涓嬫媺鏁扮粍 - UomSelectArr: [], // 鍗曚綅涓嬫媺鏁扮粍 - CheckItemSelectAllArr: [], // 妫�楠岄」鐩�(鎵�鏈�) - CheckItemSelectArr: [], // 妫�楠岄」鐩� - StepSelectArr: [], // 宸ュ簭鍚嶇О涓嬫媺鎵�鏈� - - isCancel: true// 鏄惁鍙彇娑� - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getQualityInspectionSearch().then(res => { - if (res.code === '200') { - // this.getUomSelect() - this.getStepCheckItemSelect() - this.getPartSelect() - this.getStockTypeSelect() - this.getStepSelect() - } - }) - }, - async getStepSelect() { - const { data: res } = await StepData() - this.StepSelectArr = res - }, - async getQualityInspectionSearch() { - const res = await QualityInspectionSearch(this.form) - this.tableData = res.data - this.total = res.count - - return { code: res.code } - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getQualityInspectionSearch() - }, - // 鏌ヨ - search() { - this.getQualityInspectionSearch() - }, - // 閲嶇疆 - reset() { - this.form.qualityinsptcode = '' - this.form.qualityinsptname = '' - this.form.status = '' - this.form.checktype = '' - this.form.sampltype = '' - this.form.suitobject = '' - this.getQualityInspectionSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 鏌ョ湅 - async check(operation, row) { - this.operation = operation - this.dialogVisible = true - - const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code }) - - this.$nextTick(() => { - this.dialogForm.qualityinsptcode = row.code - this.dialogForm.qualityinsptname = row.name - this.dialogForm.status = row.status - this.dialogForm.stepcode = row.stepcode - this.dialogForm.checktype = row.checktype - this.dialogForm.sampmethod = row.sampmethod - // this.dialogForm.sampscare = row.sampscare - if (this.dialogForm.sampmethod === 'FIXED') { - this.dialogForm.sampnum = row.sampscare - } else { - this.dialogForm.sampscale = row.sampscare - } - this.dialogForm.suitobject = row.suitobject - this.dialogForm.suitpart = row.suitpart.split(',') - this.dialogForm.descr = row.descr - this.checkitem = res - - this.$refs.tableDataRef2.doLayout() - }) - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code }) - - const tempCodeArr = [] - res.forEach(i => { - let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� - number = number === 0 ? (10 + Math.random()) : number - i.number = number - i.isVisible = 0 - tempCodeArr.push(i.stepcheckitem_code) - }) - - this.CheckItemSelectArr = [] - this.CheckItemSelectAllArr.forEach(i => { - if (!tempCodeArr.includes(i.code)) { - this.CheckItemSelectArr.push(i) - } - }) - - this.$nextTick(() => { - this.dialogForm.qualityinsptcode = row.code - this.dialogForm.qualityinsptname = row.name - this.dialogForm.status = row.status - this.dialogForm.stepcode = row.stepcode - this.dialogForm.checktype = row.checktype - this.dialogForm.sampmethod = row.sampmethod - if (this.dialogForm.sampmethod === 'FIXED') { - this.dialogForm.sampnum = row.sampscare - } else { - this.dialogForm.sampscale = row.sampscare - } - this.dialogForm.suitobject = row.suitobject - this.dialogForm.suitpart = row.suitpart.split(',') - this.dialogForm.descr = row.descr - this.checkitem = res - // console.log(this.checkitem, 2) - this.$refs.tableDataRef2.doLayout() - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - QualityInspectionDelete({ qualityinsptcode: row.code }).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getQualityInspectionSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 鐗╂枡涓嬫媺 - async getPartSelect() { - const { data: res } = await PartSelect() - this.PartSelectArr = res - }, - // 鐗╂枡绫诲埆涓嬫媺 - async getStockTypeSelect() { - const { data: res } = await TMaterielClassTree() - this.StockTypeSelectArr = res - }, - - // 閫傜敤瀵硅薄鍊兼敼鍙樻槸 - suitobjectChange() { - this.dialogForm.suitpart = [] - }, - // 鑾峰彇妫�楠岄」鐩笅鎷夋帴鍙� - async getStepCheckItemSelect() { - const { data: res } = await QualityStepCheckItemSelect() - - res.forEach(i => { - this.CheckItemSelectArr.push({ - code: i.code, - name: i.name + ' / ' + i.code, - descr: i.descr - }) - }) - this.CheckItemSelectAllArr = JSON.parse(JSON.stringify(this.CheckItemSelectArr)) - }, - // 鏁板�煎垽瀹� - szpdChange(val, row) { - if (val === 'N') { - row.unit = '' - row.decimalnum = '' - row.standvalue = '' - row.uppervalue = '' - row.lowervalue = '' - } - }, - // 琛ㄦ牸鍊兼敼鍙樻椂 - tableChange(val, row) { - console.log(val, row) - }, - // 璐ㄦ鍒楄〃 鏂板琛� - addZjlb() { - if (this.checkitem.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨褰撳墠琛屾暟鎹紒') - } - - let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� - number = number === 0 ? (10 + Math.random()) : number - - this.checkitem.push({ - number, - isVisible: 1, - // jyxmbm: '', - // jyxmmc: '', - stepcheckitem_code: '', // 妫�楠岄」鐩紪鐮� - required: 'Y', // 鏄惁蹇呭~ - numberjudge: 'Y', // 鏄惁鏁板�煎垽鏂� - unit: '', // 鍗曚綅 - decimalnum: '', // 灏忔暟浣嶆暟 - standvalue: '', // 鏍囧噯鍊� - uppervalue: '', // 涓婇檺鍊� - lowervalue: '', // 涓嬮檺鍊� - stepcheckitem_desc: ''// 妫�楠岄」鐩弿杩� - }) - }, - // 鍒犻櫎璐ㄦ鍒楄〃琛� - delZjlbRow(row) { - const t = this.CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code) - this.CheckItemSelectArr.unshift(t) - this.checkitem = this.checkitem.filter(i => i.number !== row.number) - }, - // 淇濆瓨琛� - saveZjlbRow(row) { - if (!row.stepcheckitem_code) { - return this.$message.info('妫�楠岄」鐩笉鑳戒负绌猴紒') - } - if (row.numberjudge === 'Y' && !row.unit) { - return this.$message.info('鍗曚綅涓嶈兘涓虹┖锛�') - } - if (row.numberjudge === 'Y' && !row.decimalnum) { - return this.$message.info('灏忔暟浣嶆暟涓嶈兘涓虹┖锛�') - } - if (row.numberjudge === 'Y') { - if (!row.standvalue && !row.uppervalue && !row.lowervalue) { - return this.$message.info('鏍囧噯鍊笺�佷笂闄愬�笺�佷笅闄愬�煎叾涓竴椤逛笉鑳戒负绌猴紒') - } - } - this.CheckItemSelectArr = this.CheckItemSelectArr.filter(i => i.code !== row.stepcheckitem_code) - row.isVisible = 0 - - this.isCancel = true - }, - // 鍙栨秷琛� - cancelZjlbRow(row) { - this.checkitem = this.checkitem.filter(i => i.number !== row.number) - }, - // 缂栬緫琛� - editZjlbRow(row) { - if (this.checkitem.find(i => i.isVisible === 1)) { - return this.$message.info('璇峰厛淇濆瓨褰撳墠琛屾暟鎹紒') - } - row.isVisible = 1 - this.isCancel = false - const t = this.CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code) - this.CheckItemSelectArr.unshift(t) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm = { - qualityinsptcode: '', - qualityinsptname: '', - status: 'Y', - checktype: 'FirstCheck', - sampmethod: 'FIXED', - sampnum: '', - stepcode: '', - sampscale: '', - suitobject: 'P', - suitpart: [], - descr: '' - } - - this.isCancel = true - this.checkitem = [] - this.CheckItemSelectArr = JSON.parse(JSON.stringify(this.CheckItemSelectAllArr)) - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - if (this.checkitem.length < 1) { - return this.$message.info('璐ㄦ鍒楄〃涓嶈兘涓虹┖锛�') - } - - const checkitem = [] - this.checkitem.forEach((item, index) => { - checkitem.push({ - stepcheckitem_seq: index + 1, - stepcheckitem_code: item.stepcheckitem_code, - stepcheckitem_desc: item.stepcheckitem_desc, - required: item.required, - numberjudge: item.numberjudge, - unit: item.unit, - decimalnum: item.decimalnum, - standvalue: item.standvalue, - uppervalue: item.uppervalue, - lowervalue: item.lowervalue - }) - }) - const data = { - qualityinsptcode: this.dialogForm.qualityinsptcode, - qualityinsptname: this.dialogForm.qualityinsptname, - status: this.dialogForm.status, - stepcode: this.dialogForm.checktype === 'InCheck' || this.dialogForm.checktype === 'OutCheck' ? '' : this.dialogForm.stepcode, - checktype: this.dialogForm.checktype, - sampmethod: this.dialogForm.sampmethod, - sampscare: this.dialogForm.sampnum ? this.dialogForm.sampnum : this.dialogForm.sampscale, - suitobject: this.dialogForm.suitobject, - suitpart: this.dialogForm.suitpart.join(','), - type: this.operation === 'add' ? 'Add' : 'Update', - descr: this.dialogForm.descr, - checkitem - } - - this.$store.state.app.buttonIsDisabled = true - QualityInspectionAddEditSave(data).then(res => { - if (res.code === '200') { - this.$message.success(this.operation === 'add' ? '淇濆瓨鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.getQualityInspectionSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$message.error(this.operation === 'add' ? '淇濆瓨澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="璐ㄦ鏂规缂栫爜" style=" display: flex;"> + <el-input v-model="form.qualityinsptcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="璐ㄦ鏂规鍚嶇О" style=" display: flex;"> + <el-input v-model="form.qualityinsptname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏈夋晥鐘舵��" style=" display: flex;"> + <el-select v-model="form.status" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in whetherOrNot" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="璐ㄦ绫诲瀷" style=" display: flex;"> + <el-select v-model="form.checktype" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checktypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶芥牱鏂瑰紡" style=" display: flex;"> + <el-select v-model="form.sampltype" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in sampltypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="閫傜敤瀵硅薄" style=" display: flex;"> + <el-select v-model="form.suitobject" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in suitobjectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + :key="tableTimeStampKey" + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <!-- <el-table-column--> + <!-- prop="RowNum"--> + <!-- width="50"--> + <!-- fixed--> + <!-- label="搴忓彿"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="code"--> + <!-- label="璐ㄦ鏂规缂栫爜"--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="name"--> + <!-- label="璐ㄦ鏂规鍚嶇О"--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="status"--> + <!-- label="鏈夋晥鐘舵��"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.status==='Y'"><i--> + <!-- class="el-icon-success"--> + <!-- :style="{color:$store.state.settings.theme}"--> + <!-- style="margin-right:5px"--> + <!-- />鏄�--> + <!-- </div>--> + <!-- <div v-else-if="row.status==='N'"><i class="el-icon-info" style="margin-right: 5px" />鍚�</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="checktype"--> + <!-- label="璐ㄦ绫诲瀷"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.checktype">{{ checktypeArr.find(i => i.code === row.checktype).name }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="sampmethod"--> + <!-- label="鎶芥牱鏂瑰紡"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.sampmethod">{{ sampltypeArr.find(i => i.code === row.sampmethod).name }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="suitobject"--> + <!-- label="閫傜敤瀵硅薄"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.suitobject">{{ suitobjectArr.find(i => i.code === row.suitobject).name }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + + <!-- <el-table-column--> + <!-- prop="username"--> + <!-- label="鍒涘缓浜哄憳"--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="lm_date"--> + <!-- label="鍒涘缓鏃堕棿"--> + <!-- width="160"--> + <!-- sortable="custom"--> + <!-- />--> + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='checktype'"> + {{ checktypeArr.find(i => i.code === row[item.prop]).name }} + </div> + <div v-else-if="item.prop==='sampmethod'"> + {{ sampltypeArr.find(i => i.code === row[item.prop]).name }} + </div> + <!-- 閫傜敤瀵硅薄--> + <div v-else-if="item.prop==='suitobject'"> + {{ suitobjectArr.find(i => i.code === row.suitobject).name }} + </div> + <div v-else-if="item.prop==='status'"> + <div v-if="row.status==='Y'"><i + class="el-icon-success" + :style="{color:$store.state.settings.theme}" + style="margin-right:5px" + />鏄� + </div> + <div v-else-if="row.status==='N'"><i class="el-icon-info" style="margin-right: 5px" />鍚�</div> + <div v-else>/</div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="鏌ョ湅" placement="top"> + <i + class="el-icon-view" + :style="{color:$store.state.settings.theme}" + style="margin-right:15px;cursor: pointer;" + @click="check('check',row)" + /> + </el-tooltip> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getQualityInspectionSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':operation==='check'?'鏌ョ湅':'缂栬緫'" + :visible.sync="dialogVisible" + width="1260px" + :close-on-click-modal="false" + top="5vh" + @closed="handleClose" + @close="handleClose" + > + + <!-- <div>--> + <!-- <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />鍩虹璧勬枡锛�--> + <!-- </div>--> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> + <el-form-item label="璐ㄦ鏂规缂栫爜" prop="qualityinsptcode"> + <el-input v-model="dialogForm.qualityinsptcode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="璐ㄦ鏂规鍚嶇О" prop="qualityinsptname"> + <el-input v-model="dialogForm.qualityinsptname" style="width: 200px" /> + </el-form-item> + <br> + <el-form-item prop="status" label="鏈夋晥鐘舵��"> + <el-select + v-model="dialogForm.status" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in whetherOrNot" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <br> + <el-form-item prop="checktype" label="璐ㄦ绫诲瀷"> + <el-radio-group v-model="dialogForm.checktype"> + <!-- <el-radio label="InCheck">鍏ュ巶妫�楠�</el-radio>--> + <!-- <el-radio label="OutCheck">鍑哄巶妫�楠�</el-radio>--> + <el-radio label="FirstCheck">棣栨妫�楠�</el-radio> + <el-radio label="PatroCheck">宸℃</el-radio> + <el-radio label="EndCheck">瀹屽伐妫�</el-radio> + </el-radio-group> + </el-form-item> + <br> + <el-form-item prop="sampmethod" label="鎶芥牱鏂瑰紡"> + <el-radio-group v-model="dialogForm.sampmethod" style="width: 200px;"> + <el-radio label="FIXED">鍥烘椂鎶芥</el-radio> + <el-radio label="SCARE">姣斾緥鎶芥</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item v-if="dialogForm.sampmethod==='FIXED'" label="鏍锋湰鏁伴噺" prop="sampnum"> + <el-input v-model="dialogForm.sampnum" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + <el-form-item v-if="dialogForm.sampmethod==='SCARE'" label="鎶芥姣斾緥" prop="sampscale"> + <el-input v-model="dialogForm.sampscale" oninput="value=value.replace(/[^0-9.]/g,'')" style="width: 180px" /> + % + </el-form-item> + <br> + <el-form-item prop="suitobject" label="閫傜敤瀵硅薄"> + <el-radio-group v-model="dialogForm.suitobject" style="width: 200px;" @change="suitobjectChange"> + <el-radio label="PY">鐗╂枡绫诲埆</el-radio> + <el-radio label="P">鐗╂枡</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item + prop="suitpart" + :label="dialogForm.suitobject==='P'?'閫傜敤鐗╂枡':'閫傜敤鐗╂枡绫诲埆'" + > + <el-select + v-model="dialogForm.suitpart" + style="width: 200px" + multiple + filterable + collapse-tags + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in PartSelectArr" + v-if="dialogForm.suitobject==='P'" + :key="item.partcode" + :label="item.partcode +' / '+ item.partname" + :value="item.partcode" + /> + <el-option + v-for="item in StockTypeSelectArr" + v-if="dialogForm.suitobject==='PY'" + :key="item.code" + :label="item.code+' / '+item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <br> + <el-form-item + label="宸ュ簭鍚嶇О" + prop="stepcode" + > + <el-select + v-model="dialogForm.stepcode" + style="width: 200px" + filterable + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in StepSelectArr" + :key="item.stepcode" + :label="item.stepname" + :value="item.stepcode" + /> + </el-select> + </el-form-item> + + <el-form-item label="妫�楠屾柟妗堟弿杩�"> + <el-input v-model="dialogForm.descr" type="textarea" :autosize="{ minRows: 2 }" /> + </el-form-item> + </el-form> + + <div style="display: flex;align-items: center;margin-bottom: 10px;"> + <div> + <i + class="el-icon-s-operation" + :style="{color:$store.state.settings.theme}" + style="margin:0 10px 0 0px;" + /> + </div> + <div>璐ㄦ鍒楄〃锛�</div> + <el-button + v-if="operation!=='check'" + v-waves + type="primary" + style="margin-left: 20px;" + icon="el-icon-circle-plus-outline" + @click="addZjlb" + >鏂板 + </el-button> + </div> + + <el-table + ref="tableDataRef2" + class="tableFixed" + :data="checkitem" + height="250" + style="height:250px" + border + :row-class-name="tableRowClassName" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + fixed + label="搴忓彿" + /> + <!-- <el-table-column--> + <!-- prop="jyxmbm"--> + <!-- width="105"--> + <!-- label="妫�楠岄」鐩紪鐮�"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <el-select--> + <!-- v-if="row.isVisible===1"--> + <!-- v-model="row.jyxmbm"--> + <!-- filterable--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- @change="val=>tableChange(val,row)"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in PartSelectArr"--> + <!-- :key="item.partname"--> + <!-- :label="item.partcode"--> + <!-- :value="item.partname"--> + <!-- />--> + <!-- </el-select>--> + <!-- <div v-if="row.isVisible===0">{{ row.jyxmbm }}</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <!-- <el-table-column--> + <!-- prop="jyxmmc"--> + <!-- width="105"--> + <!-- label="妫�楠岄」鐩悕绉�"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <el-select--> + <!-- v-if="row.isVisible===1"--> + <!-- v-model="row.jyxmmc"--> + <!-- filterable--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- @change="val=>tableChange(val,row)"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in PartSelectArr"--> + <!-- :key="item.partname"--> + <!-- :label="item.partcode"--> + <!-- :value="item.partname"--> + <!-- />--> + <!-- </el-select>--> + <!-- <div v-if="row.isVisible===0">{{ row.jyxmmc }}</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + + <el-table-column + prop="stepcheckitem_code" + width="250" + label="妫�楠岄」鐩� / 缂栫爜" + > + <template slot-scope="{row}"> + <el-select + v-if="row.isVisible===1" + v-model="row.stepcheckitem_code" + filterable + placeholder="璇烽�夋嫨" + style="width: 100%;" + > + <!-- @change="val=>tableChange(val,row)"--> + <el-option + v-for="item in CheckItemSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + <div v-else>{{ + CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code).name + }} + </div> + </template> + </el-table-column> + + <el-table-column + prop="required" + width="85" + label="鏄惁蹇呭~" + > + <template slot-scope="{row}"> + <el-select + v-if="row.isVisible===1" + v-model="row.required" + filterable + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in whetherOrNot" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + <div v-else>{{ row.required === 'Y' ? '鏄�' : '鍚�' }}</div> + </template> + </el-table-column> + <el-table-column + prop="numberjudge" + width="85" + label="鏁板�煎垽瀹�" + > + <template slot-scope="{row}"> + <el-select + v-if="row.isVisible===1" + v-model="row.numberjudge" + filterable + placeholder="璇烽�夋嫨" + @change="val=>szpdChange(val,row)" + > + <el-option + v-for="item in whetherOrNot" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + <div v-else>{{ row.numberjudge === 'Y' ? '鏄�' : '鍚�' }}</div> + </template> + </el-table-column> + <el-table-column + prop="unit" + label="鍗曚綅" + > + <template slot-scope="{row}"> + <!-- <el-select--> + <!-- v-if="row.isVisible===1"--> + <!-- v-model="row.unit"--> + <!-- filterable--> + <!-- :disabled="row.numberjudge==='N'"--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in UomSelectArr"--> + <!-- :key="item.code"--> + <!-- :label="item.name"--> + <!-- :value="item.code"--> + <!-- />--> + <!-- </el-select>--> + <!-- <div v-if="row.isVisible===0">{{--> + <!-- row.numberjudge === 'Y' ? UomSelectArr.find(i => i.code === row.unit).name : '/'--> + <!-- }}--> + <!-- </div>--> + <el-input + v-if="row.isVisible===1" + v-model="row.unit" + placeholder="璇烽�夋嫨" + :disabled="row.numberjudge==='N'" + /> + <div v-else>{{ row.unit ? row.unit : '/' }}</div> + </template> + </el-table-column> + <el-table-column + prop="decimalnum" + width="85" + label="灏忔暟浣嶆暟" + > + <template slot-scope="{row}"> + <!-- <el-select--> + <!-- v-if="row.isVisible===1"--> + <!-- v-model="row.decimalnum"--> + <!-- filterable--> + <!-- placeholder="璇烽�夋嫨"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in PartSelectArr"--> + <!-- :key="item.partname"--> + <!-- :label="item.partcode"--> + <!-- :value="item.partname"--> + <!-- />--> + <!-- </el-select>--> + <el-input + v-if="row.isVisible===1" + v-model="row.decimalnum" + :disabled="row.numberjudge==='N'" + oninput="value=value.replace(/[^0-9]/g,'')" + placeholder="璇疯緭鍏�" + /> + <div v-else>{{ row.numberjudge === 'Y' ? row.decimalnum : '/' }}</div> + </template> + </el-table-column> + <el-table-column + prop="standvalue" + label="鏍囧噯鍊�" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.standvalue" + :disabled="row.numberjudge==='N'" + oninput="value=value.replace(/[^0-9.]/g,'')" + placeholder="璇疯緭鍏�" + /> + <div v-else>{{ row.standvalue ? row.standvalue : '/' }}</div> + </template> + </el-table-column> + <el-table-column + prop="uppervalue" + label="涓婇檺鍊�" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.uppervalue" + :disabled="row.numberjudge==='N'" + oninput="value=value.replace(/[^0-9.]/g,'')" + placeholder="璇疯緭鍏�" + /> + <div v-else>{{ row.uppervalue ? row.uppervalue : '/' }}</div> + </template> + </el-table-column> + <el-table-column + prop="lowervalue" + label="涓嬮檺鍊�" + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.lowervalue" + :disabled="row.numberjudge==='N'" + oninput="value=value.replace(/[^0-9.]/g,'')" + placeholder="璇疯緭鍏�" + /> + <div v-else>{{ row.lowervalue ? row.lowervalue : '/' }}</div> + </template> + </el-table-column> + <el-table-column + prop="stepcheckitem_desc" + label="鎻忚堪" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <el-input + v-if="row.isVisible===1" + v-model="row.stepcheckitem_desc" + placeholder="璇疯緭鍏�" + /> + <div v-else>{{ row.stepcheckitem_desc ? row.stepcheckitem_desc : '/' }}</div> + </template> + </el-table-column> + <el-table-column + v-if="operation!=='check'" + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveZjlbRow(row)">纭</el-button> + <el-button v-if="row.isVisible===1&&isCancel" v-waves type="text" @click="cancelZjlbRow(row)">鍙栨秷 + </el-button> + <el-button v-if="row.isVisible!==1" v-waves type="text" @click="editZjlbRow(row)">缂栬緫</el-button> + <el-button v-if="row.isVisible!==1" v-waves type="text" @click="delZjlbRow(row)">鍒犻櫎</el-button> + </div> + </template> + </el-table-column> + </el-table> + + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-if="operation!=='check'" v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-if="operation!=='check'" + v-waves + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + type="primary" + @click="dialogVisibleConfirm" + >淇� 瀛�</el-button> + <el-button v-if="operation==='check'" v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + QualityInspectionAddEditSave, + QualityInspectionDelete, + QualityInspectionSearch, QualityInspectionSeeEdit, QualityStepCheckItemSelect +} from '@/api/QualityManagement' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PartSelect, TMaterielClassTree } from '@/api/ProductModel' +import { StepData } from '@/api/GeneralBasicData' + +export default { + name: 'QualityPlaning', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + qualityinsptcode: '', // 璐ㄦ鏂规缂栫爜 + qualityinsptname: '', // 璐ㄦ鏂规鍚嶇О + status: '', // 鏈夋晥鐘舵�� + checktype: '', // 璐ㄦ绫诲瀷 + sampltype: '', // 鎶芥牱鏂瑰紡 + suitobject: '', // 閫傜敤瀵硅薄 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checktypeArr: [ + // { code: 'InCheck', name: '鍏ュ巶妫�楠�' }, + // { code: 'OutCheck', name: '鍑哄巶妫�楠�' }, + { code: 'FirstCheck', name: '棣栨' }, + { code: 'PatroCheck', name: '宸℃' }, + { code: 'EndCheck', name: '瀹屽伐妫�' } + ], + sampltypeArr: [ + { code: 'FIXED', name: '鍥哄畾鎶芥' }, + { code: 'SCARE', name: '姣斾緥鎶芥' } + ], + suitobjectArr: [ + { code: 'P', name: '鐗╂枡' }, + { code: 'PY', name: '鐗╂枡绫诲瀷' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 130, + width: false, + prop: 'code', + label: '璐ㄦ鏂规缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 130, + width: false, + prop: 'name', + label: '璐ㄦ鏂规鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'status', + label: '鏈夋晥鐘舵��', + id: 5, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'checktype', + label: '璐ㄦ绫诲瀷', + id: 6, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'sampmethod', + label: '鎶芥牱鏂瑰紡', + id: 7, + show: true, + fixed: false, + sortable: true + }, + + { + minWidth: 110, + width: false, + prop: 'suitobject', + label: '閫傜敤瀵硅薄', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'stepcode', + label: '宸ュ簭缂栫爜', + id: 9, + show: false, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'stepname', + label: '宸ュ簭鍚嶇О', + id: 10, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'username', + label: '鍒涘缓浜哄憳', + id: 11, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 12, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + dialogVisible: false, + dialogForm: { + qualityinsptcode: '', // 璐ㄦ鏂规缂栫爜 + qualityinsptname: '', // 璐ㄦ鏂规鍚嶇О + status: 'Y', // 鏈夋晥鐘舵�� + checktype: 'FirstCheck', // 妫�楠岀被鍨� + sampmethod: 'FIXED', // 鎶芥鏂瑰紡 + sampnum: '', // 鏍锋湰鏁伴噺 + sampscale: '', // 鎶芥姣斾緥 + suitobject: 'P', // 閫傜敤瀵硅薄 + suitpart: [], // 閫傜敤鐗╂枡 + stepcode: '', // 宸ュ簭 + descr: '' // /鎻忚堪 + }, + operation: '', + dialogFormRules: { + status: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + qualityinsptcode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + qualityinsptname: [ + { required: true, message: '璇疯緭鍏ヨ川妫�鏂规鍚嶇О', trigger: ['blur', 'change'] } + ], + checktype: [ + { required: true, message: '璇烽�夋嫨璐ㄦ鏂瑰紡', trigger: ['blur', 'change'] } + ], + sampmethod: [ + { required: true, message: '璇烽�夋嫨鎶芥牱鏂瑰紡', trigger: ['blur', 'change'] } + ], + sampnum: [ + { required: true, message: '璇疯緭鍏ユ牱鏈暟閲�', trigger: ['blur', 'change'] } + ], + sampscale: [ + { required: true, message: '璇疯緭鍏ユ娊妫�姣斾緥', trigger: ['blur', 'change'] } + ], + suitobject: [ + { required: true, message: '璇烽�夋嫨閫傜敤瀵硅薄', trigger: ['blur', 'change'] } + ], + suitpart: [ + { required: true, message: '璇烽�夋嫨鐗╂枡鎴栫墿鏂欑被鍒�', trigger: ['blur', 'change'] } + ], + stepcode: [ + { required: true, message: '璇烽�夋嫨宸ュ簭鍚嶇О', trigger: ['blur', 'change'] } + ] + }, + checkitem: [], + + whetherOrNot: [ // 鏄垨鍚� + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + + PartSelectArr: [], // 鐗╂枡涓嬫媺鏁扮粍 + StockTypeSelectArr: [], // 鐗╂枡绫诲埆涓嬫媺鏁扮粍 + UomSelectArr: [], // 鍗曚綅涓嬫媺鏁扮粍 + CheckItemSelectAllArr: [], // 妫�楠岄」鐩�(鎵�鏈�) + CheckItemSelectArr: [], // 妫�楠岄」鐩� + StepSelectArr: [], // 宸ュ簭鍚嶇О涓嬫媺鎵�鏈� + + isCancel: true// 鏄惁鍙彇娑� + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getQualityInspectionSearch().then(res => { + if (res.code === '200') { + // this.getUomSelect() + this.getStepCheckItemSelect() + this.getPartSelect() + this.getStockTypeSelect() + this.getStepSelect() + } + }) + }, + async getStepSelect() { + const { data: res } = await StepData() + this.StepSelectArr = res + }, + async getQualityInspectionSearch() { + const res = await QualityInspectionSearch(this.form) + this.tableData = res.data + this.total = res.count + + return { code: res.code } + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getQualityInspectionSearch() + }, + // 鏌ヨ + search() { + this.getQualityInspectionSearch() + }, + // 閲嶇疆 + reset() { + this.form.qualityinsptcode = '' + this.form.qualityinsptname = '' + this.form.status = '' + this.form.checktype = '' + this.form.sampltype = '' + this.form.suitobject = '' + this.getQualityInspectionSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 鏌ョ湅 + async check(operation, row) { + this.operation = operation + this.dialogVisible = true + + const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code }) + + this.$nextTick(() => { + this.dialogForm.qualityinsptcode = row.code + this.dialogForm.qualityinsptname = row.name + this.dialogForm.status = row.status + this.dialogForm.stepcode = row.stepcode + this.dialogForm.checktype = row.checktype + this.dialogForm.sampmethod = row.sampmethod + // this.dialogForm.sampscare = row.sampscare + if (this.dialogForm.sampmethod === 'FIXED') { + this.dialogForm.sampnum = row.sampscare + } else { + this.dialogForm.sampscale = row.sampscare + } + this.dialogForm.suitobject = row.suitobject + this.dialogForm.suitpart = row.suitpart.split(',') + this.dialogForm.descr = row.descr + this.checkitem = res + + this.$refs.tableDataRef2.doLayout() + }) + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code }) + + const tempCodeArr = [] + res.forEach(i => { + let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� + number = number === 0 ? (10 + Math.random()) : number + i.number = number + i.isVisible = 0 + tempCodeArr.push(i.stepcheckitem_code) + }) + + this.CheckItemSelectArr = [] + this.CheckItemSelectAllArr.forEach(i => { + if (!tempCodeArr.includes(i.code)) { + this.CheckItemSelectArr.push(i) + } + }) + + this.$nextTick(() => { + this.dialogForm.qualityinsptcode = row.code + this.dialogForm.qualityinsptname = row.name + this.dialogForm.status = row.status + this.dialogForm.stepcode = row.stepcode + this.dialogForm.checktype = row.checktype + this.dialogForm.sampmethod = row.sampmethod + if (this.dialogForm.sampmethod === 'FIXED') { + this.dialogForm.sampnum = row.sampscare + } else { + this.dialogForm.sampscale = row.sampscare + } + this.dialogForm.suitobject = row.suitobject + this.dialogForm.suitpart = row.suitpart.split(',') + this.dialogForm.descr = row.descr + this.checkitem = res + // console.log(this.checkitem, 2) + this.$refs.tableDataRef2.doLayout() + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + QualityInspectionDelete({ qualityinsptcode: row.code }).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getQualityInspectionSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 鐗╂枡涓嬫媺 + async getPartSelect() { + const { data: res } = await PartSelect() + this.PartSelectArr = res + }, + // 鐗╂枡绫诲埆涓嬫媺 + async getStockTypeSelect() { + const { data: res } = await TMaterielClassTree() + this.StockTypeSelectArr = res + }, + + // 閫傜敤瀵硅薄鍊兼敼鍙樻槸 + suitobjectChange() { + this.dialogForm.suitpart = [] + }, + // 鑾峰彇妫�楠岄」鐩笅鎷夋帴鍙� + async getStepCheckItemSelect() { + const { data: res } = await QualityStepCheckItemSelect() + + res.forEach(i => { + this.CheckItemSelectArr.push({ + code: i.code, + name: i.name + ' / ' + i.code, + descr: i.descr + }) + }) + this.CheckItemSelectAllArr = JSON.parse(JSON.stringify(this.CheckItemSelectArr)) + }, + // 鏁板�煎垽瀹� + szpdChange(val, row) { + if (val === 'N') { + row.unit = '' + row.decimalnum = '' + row.standvalue = '' + row.uppervalue = '' + row.lowervalue = '' + } + }, + // 琛ㄦ牸鍊兼敼鍙樻椂 + tableChange(val, row) { + console.log(val, row) + }, + // 璐ㄦ鍒楄〃 鏂板琛� + addZjlb() { + if (this.checkitem.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨褰撳墠琛屾暟鎹紒') + } + + let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗� + number = number === 0 ? (10 + Math.random()) : number + + this.checkitem.push({ + number, + isVisible: 1, + // jyxmbm: '', + // jyxmmc: '', + stepcheckitem_code: '', // 妫�楠岄」鐩紪鐮� + required: 'Y', // 鏄惁蹇呭~ + numberjudge: 'Y', // 鏄惁鏁板�煎垽鏂� + unit: '', // 鍗曚綅 + decimalnum: '', // 灏忔暟浣嶆暟 + standvalue: '', // 鏍囧噯鍊� + uppervalue: '', // 涓婇檺鍊� + lowervalue: '', // 涓嬮檺鍊� + stepcheckitem_desc: ''// 妫�楠岄」鐩弿杩� + }) + }, + // 鍒犻櫎璐ㄦ鍒楄〃琛� + delZjlbRow(row) { + const t = this.CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code) + this.CheckItemSelectArr.unshift(t) + this.checkitem = this.checkitem.filter(i => i.number !== row.number) + }, + // 淇濆瓨琛� + saveZjlbRow(row) { + if (!row.stepcheckitem_code) { + return this.$message.info('妫�楠岄」鐩笉鑳戒负绌猴紒') + } + if (row.numberjudge === 'Y' && !row.unit) { + return this.$message.info('鍗曚綅涓嶈兘涓虹┖锛�') + } + if (row.numberjudge === 'Y' && !row.decimalnum) { + return this.$message.info('灏忔暟浣嶆暟涓嶈兘涓虹┖锛�') + } + if (row.numberjudge === 'Y') { + if (!row.standvalue && !row.uppervalue && !row.lowervalue) { + return this.$message.info('鏍囧噯鍊笺�佷笂闄愬�笺�佷笅闄愬�煎叾涓竴椤逛笉鑳戒负绌猴紒') + } + } + this.CheckItemSelectArr = this.CheckItemSelectArr.filter(i => i.code !== row.stepcheckitem_code) + row.isVisible = 0 + + this.isCancel = true + }, + // 鍙栨秷琛� + cancelZjlbRow(row) { + this.checkitem = this.checkitem.filter(i => i.number !== row.number) + }, + // 缂栬緫琛� + editZjlbRow(row) { + if (this.checkitem.find(i => i.isVisible === 1)) { + return this.$message.info('璇峰厛淇濆瓨褰撳墠琛屾暟鎹紒') + } + row.isVisible = 1 + this.isCancel = false + const t = this.CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code) + this.CheckItemSelectArr.unshift(t) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm = { + qualityinsptcode: '', + qualityinsptname: '', + status: 'Y', + checktype: 'FirstCheck', + sampmethod: 'FIXED', + sampnum: '', + stepcode: '', + sampscale: '', + suitobject: 'P', + suitpart: [], + descr: '' + } + + this.isCancel = true + this.checkitem = [] + this.CheckItemSelectArr = JSON.parse(JSON.stringify(this.CheckItemSelectAllArr)) + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + if (this.checkitem.length < 1) { + return this.$message.info('璐ㄦ鍒楄〃涓嶈兘涓虹┖锛�') + } + + const checkitem = [] + this.checkitem.forEach((item, index) => { + checkitem.push({ + stepcheckitem_seq: index + 1, + stepcheckitem_code: item.stepcheckitem_code, + stepcheckitem_desc: item.stepcheckitem_desc, + required: item.required, + numberjudge: item.numberjudge, + unit: item.unit, + decimalnum: item.decimalnum, + standvalue: item.standvalue, + uppervalue: item.uppervalue, + lowervalue: item.lowervalue + }) + }) + const data = { + qualityinsptcode: this.dialogForm.qualityinsptcode, + qualityinsptname: this.dialogForm.qualityinsptname, + status: this.dialogForm.status, + stepcode: this.dialogForm.checktype === 'InCheck' || this.dialogForm.checktype === 'OutCheck' ? '' : this.dialogForm.stepcode, + checktype: this.dialogForm.checktype, + sampmethod: this.dialogForm.sampmethod, + sampscare: this.dialogForm.sampnum ? this.dialogForm.sampnum : this.dialogForm.sampscale, + suitobject: this.dialogForm.suitobject, + suitpart: this.dialogForm.suitpart.join(','), + type: this.operation === 'add' ? 'Add' : 'Update', + descr: this.dialogForm.descr, + checkitem + } + + this.$store.state.app.buttonIsDisabled = true + QualityInspectionAddEditSave(data).then(res => { + if (res.code === '200') { + this.$message.success(this.operation === 'add' ? '淇濆瓨鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.getQualityInspectionSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$message.error(this.operation === 'add' ? '淇濆瓨澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} +</style> diff --git a/src/views/sopManager/sopDevice.vue b/src/views/sopManager/sopDevice.vue index 0a30729..92130e5 100644 --- a/src/views/sopManager/sopDevice.vue +++ b/src/views/sopManager/sopDevice.vue @@ -1,491 +1,497 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> - <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> - <div style="display: flex;align-items: center"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - > - <div class="elForm" style="justify-content: flex-start"> - <el-form-item style="margin-right: 30px"> - <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> - </el-form-item> - <el-form-item> - <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> - </el-form-item> - </div> - </el-form> - <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="filename" - label="鏂囦欢鍚嶇О" - min-width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filename">{{ row.filename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="filetypename" - label="鏂囦欢绫诲瀷" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filetypename">{{ row.filetypename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="version" - label="鐗堟湰鍙�" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.version">{{ row.version }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="eqptypename" - label="璁惧绫诲瀷" - min-width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="eqpname" - label="璁惧淇℃伅" - min-width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="username" - min-width="110" - label="涓婁紶浜哄憳" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.username">{{ row.username }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="lm_date" - label="涓婁紶鏃堕棿" - min-width="160" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> - <i - class="el-icon-files" - style="cursor: pointer;color:#42b983;margin-right: 15px" - @click="check(row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceSopSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏂囦欢涓婁紶" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="璁惧绫诲瀷" prop="devicetypecode"> - <el-select - v-model="dialogForm.devicetypecode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="devicetypecodeChange" - > - <el-option - v-for="item in devicetypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="璁惧淇℃伅" prop="device"> - <el-select - v-model="dialogForm.device" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - multiple - collapse-tags - :popper-append-to-body="false" - > - <el-option - v-for="item in deviceArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <!-- <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">--> - <!-- <el-form-item label="鏂囦欢鍚嶇О">--> - <!-- <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> - <el-select - v-model="dialogForm.filetypecode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - > - <el-option - v-for="item in filetypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <!-- <el-form-item label="鐗堟湰鍙�">--> - <!-- <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="鏂囦欢涓婁紶" prop="Files"> - <div style="width: 200px;"> - <el-upload - ref="uploadFileRef" - style="display: inline-block;" - action="#" - :limit="1" - :show-file-list="true" - :on-exceed="handleExceed" - :auto-upload="false" - :multiple="false" - accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" - > - <el-button - v-waves - type="primary" - style="width: 200px;display: flex;justify-content: center" - icon="el-icon-upload2" - >閫夋嫨鏂囦欢 - </el-button> - </el-upload> - </div> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { DeviceSopAddSeave, DeviceSopDeleteSeave, DeviceSopSearch } from '@/api/SopManager' -import { DeviceTypeSearch } from '@/api/DeviceManager' -import { EqpTypecodeSeachEqpPermissions } from '@/api/GeneralBasicData' -import waves from '@/directive/waves' -import elDragDialog from '@/directive/el-drag-dialog' - -export default { - name: 'SopDevice', - components: { - Pagination - }, - directives: { waves, elDragDialog }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� - search: '', // 鎼滅储鍏抽敭瀛� - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checked: false, - - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - devicetypecode: '', // 璁惧绫诲瀷缂栫爜 - device: '', // 鐗╂枡缂栫爜 - defilename: '', - filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 - Files: '', // 鏂囦欢 - fileversion: ''// 鏂囦欢鐗堟湰鍙� - }, - dialogFormRules: { - devicetypecode: [ - { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } - ], - device: [ - { required: true, message: '璇烽�夋嫨璁惧淇℃伅', trigger: ['blur', 'change'] } - ], - defilename: [ - { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } - ], - filetypecode: [ - { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } - ] - }, - devicetypeArr: [], // 璁惧绫诲瀷涓嬫媺鍒楄〃 - deviceArr: [], // 鐗╂枡涓嬫媺鍒楄〃 - filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 - { code: 'P001', name: '浣滀笟鎸囧涔�' }, - { code: 'P002', name: '妫�楠屾寚瀵间功' }, - { code: 'P003', name: '鍥剧焊' } - ] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getDeviceSopSearch() - this.getDeviceTypeSearch() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getDeviceSopSearch() { - const res = await DeviceSopSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - async getDeviceTypeSearch() { - const { data: res } = await DeviceTypeSearch() - this.devicetypeArr = res - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceSopSearch() - }, - // 鏌ヨ - search() { - this.getDeviceSopSearch() - }, - // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 - checkedChange(val) { - this.form.check = val ? 'Y' : 'N' - this.getDeviceSopSearch() - }, - // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 - handleExceed() { - this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') - }, - - async devicetypecodeChange(eqptypecode) { - const { data: res } = await EqpTypecodeSeachEqpPermissions({ eqptypecode }) - this.deviceArr = res - this.dialogForm.device = res.length > 0 ? res.map(i => i.code) : [] - }, - // 閲嶇疆 - reset() { - this.form.search = '' - this.getDeviceSopSearch() - }, - // 鏂板鎸夐挳 - add() { - this.dialogVisible = true - }, - - // 棰勮 - async check(row) { - window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) - }, - - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const data = { - id: row.id, - eqpcode: row.eqpcode, - filepath: row.filepath - } - DeviceSopDeleteSeave(data).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceSopSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.devicetypecode = '' - this.dialogForm.device = '' - this.dialogForm.defilename = '' - this.dialogForm.filetypecode = '' - this.dialogForm.fileversion = '' - this.dialogForm.Files = '' - this.$refs.uploadFileRef.clearFiles() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - console.log(this.$refs.uploadFileRef.uploadFiles[0]) - - if (!this.$refs.uploadFileRef.uploadFiles[0]) { - return this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') - } - - const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 - if (!isLt100M) { - return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - const formData = new FormData() - formData.append('eqptypecode', this.dialogForm.devicetypecode) - formData.append('device', this.dialogForm.device.join(',')) - formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) - formData.append('filetypecode', this.dialogForm.filetypecode) - formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) - // for (var [key, value] of formData) { - // console.log(key, value) - // } - this.$store.state.app.buttonIsDisabled = true - DeviceSopAddSeave(formData).then(res => { - if (res.code === '200') { - this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getDeviceSopSearch() - } else { - this.$message.error('鏂囦欢涓婁紶澶辫触锛�') - this.$store.state.app.buttonIsDisabled = false - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 185 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> + <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> + <div style="display: flex;align-items: center"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + > + <div class="elForm" style="justify-content: flex-start"> + <el-form-item style="margin-right: 30px"> + <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> + </el-form-item> + <el-form-item> + <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> + </el-form-item> + </div> + </el-form> + <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="filename" + label="鏂囦欢鍚嶇О" + min-width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filename">{{ row.filename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="filetypename" + label="鏂囦欢绫诲瀷" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filetypename">{{ row.filetypename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="version" + label="鐗堟湰鍙�" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.version">{{ row.version }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="eqptypename" + label="璁惧绫诲瀷" + min-width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="eqpname" + label="璁惧淇℃伅" + min-width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="username" + min-width="110" + label="涓婁紶浜哄憳" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.username">{{ row.username }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="lm_date" + label="涓婁紶鏃堕棿" + min-width="160" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> + <i + class="el-icon-files" + style="cursor: pointer;color:#42b983;margin-right: 15px" + @click="check(row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceSopSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏂囦欢涓婁紶" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="璁惧绫诲瀷" prop="devicetypecode"> + <el-select + v-model="dialogForm.devicetypecode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="devicetypecodeChange" + > + <el-option + v-for="item in devicetypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="璁惧淇℃伅" prop="device"> + <el-select + v-model="dialogForm.device" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + multiple + collapse-tags + :popper-append-to-body="false" + > + <el-option + v-for="item in deviceArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <!-- <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">--> + <!-- <el-form-item label="鏂囦欢鍚嶇О">--> + <!-- <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> + <el-select + v-model="dialogForm.filetypecode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + > + <el-option + v-for="item in filetypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <!-- <el-form-item label="鐗堟湰鍙�">--> + <!-- <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="鏂囦欢涓婁紶" prop="Files"> + <div style="width: 200px;"> + <el-upload + ref="uploadFileRef" + style="display: inline-block;" + action="#" + :limit="1" + :show-file-list="true" + :on-exceed="handleExceed" + :auto-upload="false" + :multiple="false" + accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" + > + <el-button + v-waves + type="primary" + style="width: 200px;display: flex;justify-content: center" + icon="el-icon-upload2" + >閫夋嫨鏂囦欢 + </el-button> + </el-upload> + </div> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { DeviceSopAddSeave, DeviceSopDeleteSeave, DeviceSopSearch } from '@/api/SopManager' +import { DeviceTypeSearch } from '@/api/DeviceManager' +import { EqpTypecodeSeachEqpPermissions } from '@/api/GeneralBasicData' +import waves from '@/directive/waves' +import elDragDialog from '@/directive/el-drag-dialog' + +export default { + name: 'SopDevice', + components: { + Pagination + }, + directives: { waves, elDragDialog }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� + search: '', // 鎼滅储鍏抽敭瀛� + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checked: false, + + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + devicetypecode: '', // 璁惧绫诲瀷缂栫爜 + device: '', // 鐗╂枡缂栫爜 + defilename: '', + filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 + Files: '', // 鏂囦欢 + fileversion: ''// 鏂囦欢鐗堟湰鍙� + }, + dialogFormRules: { + devicetypecode: [ + { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } + ], + device: [ + { required: true, message: '璇烽�夋嫨璁惧淇℃伅', trigger: ['blur', 'change'] } + ], + defilename: [ + { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } + ], + filetypecode: [ + { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } + ] + }, + devicetypeArr: [], // 璁惧绫诲瀷涓嬫媺鍒楄〃 + deviceArr: [], // 鐗╂枡涓嬫媺鍒楄〃 + filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 + { code: 'P001', name: '浣滀笟鎸囧涔�' }, + { code: 'P002', name: '妫�楠屾寚瀵间功' }, + { code: 'P003', name: '鍥剧焊' } + ] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getDeviceSopSearch() + this.getDeviceTypeSearch() + }, + created() { + this.getDeviceSopSearch() + this.getDeviceTypeSearch() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getDeviceSopSearch() { + const res = await DeviceSopSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + async getDeviceTypeSearch() { + const { data: res } = await DeviceTypeSearch() + this.devicetypeArr = res + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceSopSearch() + }, + // 鏌ヨ + search() { + this.getDeviceSopSearch() + }, + // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 + checkedChange(val) { + this.form.check = val ? 'Y' : 'N' + this.getDeviceSopSearch() + }, + // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 + handleExceed() { + this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') + }, + + async devicetypecodeChange(eqptypecode) { + const { data: res } = await EqpTypecodeSeachEqpPermissions({ eqptypecode }) + this.deviceArr = res + this.dialogForm.device = res.length > 0 ? res.map(i => i.code) : [] + }, + // 閲嶇疆 + reset() { + this.form.search = '' + this.getDeviceSopSearch() + }, + // 鏂板鎸夐挳 + add() { + this.dialogVisible = true + }, + + // 棰勮 + async check(row) { + window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) + }, + + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const data = { + id: row.id, + eqpcode: row.eqpcode, + filepath: row.filepath + } + DeviceSopDeleteSeave(data).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceSopSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.devicetypecode = '' + this.dialogForm.device = '' + this.dialogForm.defilename = '' + this.dialogForm.filetypecode = '' + this.dialogForm.fileversion = '' + this.dialogForm.Files = '' + this.$refs.uploadFileRef.clearFiles() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + console.log(this.$refs.uploadFileRef.uploadFiles[0]) + + if (!this.$refs.uploadFileRef.uploadFiles[0]) { + return this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') + } + + const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 + if (!isLt100M) { + return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + const formData = new FormData() + formData.append('eqptypecode', this.dialogForm.devicetypecode) + formData.append('device', this.dialogForm.device.join(',')) + formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) + formData.append('filetypecode', this.dialogForm.filetypecode) + formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) + // for (var [key, value] of formData) { + // console.log(key, value) + // } + this.$store.state.app.buttonIsDisabled = true + DeviceSopAddSeave(formData).then(res => { + if (res.code === '200') { + this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getDeviceSopSearch() + } else { + this.$message.error('鏂囦欢涓婁紶澶辫触锛�') + this.$store.state.app.buttonIsDisabled = false + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 185 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/sopManager/sopRoute.vue b/src/views/sopManager/sopRoute.vue index 440fd4e..1b5230a 100644 --- a/src/views/sopManager/sopRoute.vue +++ b/src/views/sopManager/sopRoute.vue @@ -1,581 +1,587 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> - <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> - <div style="display: flex;align-items: center"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - > - <div class="elForm" style="justify-content: flex-start"> - <el-form-item style="margin-right: 30px"> - <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> - </el-form-item> - <el-form-item> - <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> - </el-form-item> - </div> - </el-form> - <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ - </el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - - <el-table-column - prop="filename" - label="鏂囦欢鍚嶇О" - min-width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filename">{{ row.filename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="filetypename" - label="鏂囦欢绫诲瀷" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filetypename">{{ row.filetypename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="version" - label="鐗堟湰鍙�" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.version">{{ row.version }}</div> - <div v-else>/</div> - </template> - </el-table-column> - - <el-table-column - prop="materielcode" - label="浜у搧缂栫爜" - - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="materielname" - label="浜у搧鍚嶇О" - - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - v-if="mesSetting.route" - prop="routename" - label="宸ヨ壓璺嚎" - - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - - show-tooltip-when-overflow - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="eqptypename"--> - <!-- label="璁惧绫诲瀷"--> - <!-- min-width="110"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <!-- <el-table-column--> - <!-- prop="eqpname"--> - <!-- label="璁惧淇℃伅"--> - <!-- min-width="110"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - /> - <el-table-column - prop="username" - min-width="110" - label="涓婁紶浜哄憳" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.username">{{ row.username }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="lm_date" - label="涓婁紶鏃堕棿" - min-width="160" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> - <i - class="el-icon-files" - style="cursor: pointer;color:#42b983;margin-right: 15px" - @click="check(row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getProcessSopSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏂囦欢涓婁紶" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="浜у搧淇℃伅" prop="partcode"> - <el-select - v-model="dialogForm.partcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="partcodeChange" - > - <el-option - v-for="item in partcodeArr" - :key="item.partcode" - :label="item.partname+' / '+item.partcode" - :value="item.partcode" - /> - </el-select> - </el-form-item> - <el-form-item - v-if="mesSetting.route" - label="宸ヨ壓淇℃伅" - prop="route" - > - <el-select - v-model="dialogForm.route" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - collapse-tags - :popper-append-to-body="false" - @change="routeChange" - > - <el-option - v-for="item in routeArr" - :key="item.route_code" - :label="item.route_name" - :value="item.route_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ簭淇℃伅" prop="stepcode"> - <el-select - v-model="dialogForm.stepcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - collapse-tags - :popper-append-to-body="false" - @change="stepcodeChange" - > - <el-option - v-for="item in stepcodeArr" - :key="item.step_code" - :label="item.step_name" - :value="item.step_code" - /> - </el-select> - </el-form-item> - <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> - <el-select - v-model="dialogForm.filetypecode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="stepcodeChange" - > - <el-option - v-for="item in filetypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鐗堟湰鍙�"> - <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" /> - </el-form-item> - <el-form-item label="鏂囦欢涓婁紶" prop="Files"> - <div style="width: 200px;"> - <el-upload - ref="uploadFileRef" - style="display: inline-block;" - action="#" - :limit="1" - :show-file-list="true" - :on-exceed="handleExceed" - :auto-upload="false" - :multiple="false" - accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" - > - <!-- accept=".mp4,.pdf"--> - <el-button - v-waves - type="primary" - style="width: 200px;display: flex;justify-content: center" - icon="el-icon-upload2" - >閫夋嫨鏂囦欢 - </el-button> - </el-upload> - </div> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { ProcessSopAddSeave, ProcessSopDeleteSeave, ProcessSopSearch, ProcessSopMaxVersion } from '@/api/SopManager' -import waves from '@/directive/waves' -import elDragDialog from '@/directive/el-drag-dialog' -import { PartSelect } from '@/api/ProductModel' -import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings' - -export default { - name: 'SopRoute', - directives: { waves, elDragDialog }, - components: { - Pagination - }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� - search: '', // 鎼滅储鍏抽敭瀛� - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checked: false, - - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - partcode: '', // 璁惧绫诲瀷缂栫爜 - route: '', // 鐗╂枡缂栫爜 - stepcode: '', - defilename: '', - filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 - Files: '', // 鏂囦欢 - - fileversion: ''// 鏂囦欢鐗堟湰鍙� - }, - dialogFormRules: { - partcode: [ - { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } - ], - route: [ - { required: true, message: '璇烽�夋嫨璁惧淇℃伅', trigger: ['blur', 'change'] } - ], - stepcode: [ - { required: true, message: '璇烽�夋嫨宸ュ簭淇℃伅', trigger: ['blur', 'change'] } - ], - defilename: [ - { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } - ], - filetypecode: [ - { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } - ] - }, - partcodeArr: [], - routeArr: [], - stepcodeArr: [], - filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 - { code: 'P001', name: '浣滀笟鎸囧涔�' }, - { code: 'P002', name: '妫�楠屾寚瀵间功' }, - { code: 'P003', name: '鍥剧焊' } - ], - mesSetting: JSON.parse(localStorage.getItem('mesSetting')) - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getProcessSopSearch() - this.getPartSelect() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getPartSelect() { - const { data: res } = await PartSelect() - this.partcodeArr = res - }, - async getProcessSopSearch() { - const res = await ProcessSopSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getProcessSopSearch() - }, - // 鏌ヨ - search() { - this.getProcessSopSearch() - }, - // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 - checkedChange(val) { - this.form.check = val ? 'Y' : 'N' - this.getProcessSopSearch() - }, - // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 - handleExceed() { - this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') - }, - async partcodeChange(partcode) { - const { data: res } = await PartSelectRpute({ partcode }) - if (this.mesSetting.route) { - this.routeArr = res - } else { - this.stepcodeArr = res - } - this.dialogForm.route = '' - this.dialogForm.stepcode = '' - await this.stepcodeChange() - }, - async routeChange() { - const data = { - partcode: this.dialogForm.partcode, - routecode: this.dialogForm.route - } - const { data: res } = await RouteSelectStep(data) - this.stepcodeArr = res - this.dialogForm.stepcode = '' - await this.stepcodeChange() - }, - async stepcodeChange() { - if (this.dialogForm.partcode && this.dialogForm.stepcode && this.dialogForm.filetypecode) { - const data = { - partcode: this.dialogForm.partcode, - routecode: this.dialogForm.route, - stepcode: this.dialogForm.stepcode, - filetypecode: this.dialogForm.filetypecode - } - const { data: res } = await ProcessSopMaxVersion(data) - this.dialogForm.fileversion = res - } - }, - - // 閲嶇疆 - reset() { - this.form.search = '' - this.getProcessSopSearch() - }, - // 鏂板鎸夐挳 - add() { - this.dialogVisible = true - }, - // 棰勮 - async check(row) { - window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const data = { - id: row.id, - partcode: row.materielcode, - routecode: row.routecode ? row.routecode : '', - stepcode: row.stepcode, - filepath: row.filepath - } - ProcessSopDeleteSeave(data).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getProcessSopSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.partcode = '' - this.dialogForm.route = '' - this.dialogForm.defilename = '' - this.dialogForm.filetypecode = '' - this.dialogForm.fileversion = '' - this.dialogForm.stepcode = '' - this.dialogForm.Files = '' - this.$refs.uploadFileRef.clearFiles() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - console.log(this.$refs.uploadFileRef.uploadFiles[0]) - if (!this.$refs.uploadFileRef.uploadFiles[0]) { - this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') - } - - const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 - if (!isLt100M) { - return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - const formData = new FormData() - formData.append('partcode', this.dialogForm.partcode) - formData.append('routecode', this.dialogForm.route) - formData.append('stepcode', this.dialogForm.stepcode) - formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) - formData.append('filetypecode', this.dialogForm.filetypecode) - formData.append('version', this.dialogForm.fileversion) - formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) - // for (var [key, value] of formData) { - // console.log(key, value) - // } - this.$store.state.app.buttonIsDisabled = true - ProcessSopAddSeave(formData).then(res => { - if (res.code === '200') { - this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getProcessSopSearch() - } else { - this.$message.error('鏂囦欢涓婁紶澶辫触锛�') - this.$store.state.app.buttonIsDisabled = false - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 185 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> + <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> + <div style="display: flex;align-items: center"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + > + <div class="elForm" style="justify-content: flex-start"> + <el-form-item style="margin-right: 30px"> + <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> + </el-form-item> + <el-form-item> + <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> + </el-form-item> + </div> + </el-form> + <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ + </el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + + <el-table-column + prop="filename" + label="鏂囦欢鍚嶇О" + min-width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filename">{{ row.filename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="filetypename" + label="鏂囦欢绫诲瀷" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filetypename">{{ row.filetypename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="version" + label="鐗堟湰鍙�" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.version">{{ row.version }}</div> + <div v-else>/</div> + </template> + </el-table-column> + + <el-table-column + prop="materielcode" + label="浜у搧缂栫爜" + + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="materielname" + label="浜у搧鍚嶇О" + + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + v-if="mesSetting.route" + prop="routename" + label="宸ヨ壓璺嚎" + + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + + show-tooltip-when-overflow + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="eqptypename"--> + <!-- label="璁惧绫诲瀷"--> + <!-- min-width="110"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <!-- <el-table-column--> + <!-- prop="eqpname"--> + <!-- label="璁惧淇℃伅"--> + <!-- min-width="110"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + /> + <el-table-column + prop="username" + min-width="110" + label="涓婁紶浜哄憳" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.username">{{ row.username }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="lm_date" + label="涓婁紶鏃堕棿" + min-width="160" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> + <i + class="el-icon-files" + style="cursor: pointer;color:#42b983;margin-right: 15px" + @click="check(row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getProcessSopSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏂囦欢涓婁紶" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="浜у搧淇℃伅" prop="partcode"> + <el-select + v-model="dialogForm.partcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="partcodeChange" + > + <el-option + v-for="item in partcodeArr" + :key="item.partcode" + :label="item.partname+' / '+item.partcode" + :value="item.partcode" + /> + </el-select> + </el-form-item> + <el-form-item + v-if="mesSetting.route" + label="宸ヨ壓淇℃伅" + prop="route" + > + <el-select + v-model="dialogForm.route" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + collapse-tags + :popper-append-to-body="false" + @change="routeChange" + > + <el-option + v-for="item in routeArr" + :key="item.route_code" + :label="item.route_name" + :value="item.route_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ簭淇℃伅" prop="stepcode"> + <el-select + v-model="dialogForm.stepcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + collapse-tags + :popper-append-to-body="false" + @change="stepcodeChange" + > + <el-option + v-for="item in stepcodeArr" + :key="item.step_code" + :label="item.step_name" + :value="item.step_code" + /> + </el-select> + </el-form-item> + <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> + <el-select + v-model="dialogForm.filetypecode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="stepcodeChange" + > + <el-option + v-for="item in filetypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鐗堟湰鍙�"> + <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" /> + </el-form-item> + <el-form-item label="鏂囦欢涓婁紶" prop="Files"> + <div style="width: 200px;"> + <el-upload + ref="uploadFileRef" + style="display: inline-block;" + action="#" + :limit="1" + :show-file-list="true" + :on-exceed="handleExceed" + :auto-upload="false" + :multiple="false" + accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" + > + <!-- accept=".mp4,.pdf"--> + <el-button + v-waves + type="primary" + style="width: 200px;display: flex;justify-content: center" + icon="el-icon-upload2" + >閫夋嫨鏂囦欢 + </el-button> + </el-upload> + </div> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { ProcessSopAddSeave, ProcessSopDeleteSeave, ProcessSopSearch, ProcessSopMaxVersion } from '@/api/SopManager' +import waves from '@/directive/waves' +import elDragDialog from '@/directive/el-drag-dialog' +import { PartSelect } from '@/api/ProductModel' +import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings' + +export default { + name: 'SopRoute', + directives: { waves, elDragDialog }, + components: { + Pagination + }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� + search: '', // 鎼滅储鍏抽敭瀛� + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checked: false, + + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + partcode: '', // 璁惧绫诲瀷缂栫爜 + route: '', // 鐗╂枡缂栫爜 + stepcode: '', + defilename: '', + filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 + Files: '', // 鏂囦欢 + + fileversion: ''// 鏂囦欢鐗堟湰鍙� + }, + dialogFormRules: { + partcode: [ + { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } + ], + route: [ + { required: true, message: '璇烽�夋嫨璁惧淇℃伅', trigger: ['blur', 'change'] } + ], + stepcode: [ + { required: true, message: '璇烽�夋嫨宸ュ簭淇℃伅', trigger: ['blur', 'change'] } + ], + defilename: [ + { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } + ], + filetypecode: [ + { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } + ] + }, + partcodeArr: [], + routeArr: [], + stepcodeArr: [], + filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 + { code: 'P001', name: '浣滀笟鎸囧涔�' }, + { code: 'P002', name: '妫�楠屾寚瀵间功' }, + { code: 'P003', name: '鍥剧焊' } + ], + mesSetting: JSON.parse(localStorage.getItem('mesSetting')) + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getProcessSopSearch() + this.getPartSelect() + }, + created() { + this.getProcessSopSearch() + this.getPartSelect() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getPartSelect() { + const { data: res } = await PartSelect() + this.partcodeArr = res + }, + async getProcessSopSearch() { + const res = await ProcessSopSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getProcessSopSearch() + }, + // 鏌ヨ + search() { + this.getProcessSopSearch() + }, + // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 + checkedChange(val) { + this.form.check = val ? 'Y' : 'N' + this.getProcessSopSearch() + }, + // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 + handleExceed() { + this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') + }, + async partcodeChange(partcode) { + const { data: res } = await PartSelectRpute({ partcode }) + if (this.mesSetting.route) { + this.routeArr = res + } else { + this.stepcodeArr = res + } + this.dialogForm.route = '' + this.dialogForm.stepcode = '' + await this.stepcodeChange() + }, + async routeChange() { + const data = { + partcode: this.dialogForm.partcode, + routecode: this.dialogForm.route + } + const { data: res } = await RouteSelectStep(data) + this.stepcodeArr = res + this.dialogForm.stepcode = '' + await this.stepcodeChange() + }, + async stepcodeChange() { + if (this.dialogForm.partcode && this.dialogForm.stepcode && this.dialogForm.filetypecode) { + const data = { + partcode: this.dialogForm.partcode, + routecode: this.dialogForm.route, + stepcode: this.dialogForm.stepcode, + filetypecode: this.dialogForm.filetypecode + } + const { data: res } = await ProcessSopMaxVersion(data) + this.dialogForm.fileversion = res + } + }, + + // 閲嶇疆 + reset() { + this.form.search = '' + this.getProcessSopSearch() + }, + // 鏂板鎸夐挳 + add() { + this.dialogVisible = true + }, + // 棰勮 + async check(row) { + window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const data = { + id: row.id, + partcode: row.materielcode, + routecode: row.routecode ? row.routecode : '', + stepcode: row.stepcode, + filepath: row.filepath + } + ProcessSopDeleteSeave(data).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getProcessSopSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.partcode = '' + this.dialogForm.route = '' + this.dialogForm.defilename = '' + this.dialogForm.filetypecode = '' + this.dialogForm.fileversion = '' + this.dialogForm.stepcode = '' + this.dialogForm.Files = '' + this.$refs.uploadFileRef.clearFiles() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + console.log(this.$refs.uploadFileRef.uploadFiles[0]) + if (!this.$refs.uploadFileRef.uploadFiles[0]) { + this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') + } + + const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 + if (!isLt100M) { + return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + const formData = new FormData() + formData.append('partcode', this.dialogForm.partcode) + formData.append('routecode', this.dialogForm.route) + formData.append('stepcode', this.dialogForm.stepcode) + formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) + formData.append('filetypecode', this.dialogForm.filetypecode) + formData.append('version', this.dialogForm.fileversion) + formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) + // for (var [key, value] of formData) { + // console.log(key, value) + // } + this.$store.state.app.buttonIsDisabled = true + ProcessSopAddSeave(formData).then(res => { + if (res.code === '200') { + this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getProcessSopSearch() + } else { + this.$message.error('鏂囦欢涓婁紶澶辫触锛�') + this.$store.state.app.buttonIsDisabled = false + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 185 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/sopManager/sopWorkOrder.vue b/src/views/sopManager/sopWorkOrder.vue index d12ef59..60677b4 100644 --- a/src/views/sopManager/sopWorkOrder.vue +++ b/src/views/sopManager/sopWorkOrder.vue @@ -1,518 +1,525 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> - <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> - <div style="display: flex;align-items: center"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - > - <div class="elForm" style="justify-content: flex-start"> - <el-form-item style="margin-right: 30px"> - <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> - </el-form-item> - <el-form-item> - <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> - </el-form-item> - </div> - </el-form> - <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ - </el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="filename" - label="鏂囦欢鍚嶇О" - min-width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filename">{{ row.filename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="filetypename" - label="鏂囦欢绫诲瀷" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.filetypename">{{ row.filetypename }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="version" - label="鐗堟湰鍙�" - min-width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.version">{{ row.version }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wo" - label="宸ュ崟鍙�" - min-width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="materielcode" - label="鐗╂枡缂栫爜" - min-width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="materielname" - label="鐗╂枡鍚嶇О" - min-width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="username" - min-width="110" - label="涓婁紶浜哄憳" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.username">{{ row.username }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="lm_date" - label="涓婁紶鏃堕棿" - min-width="160" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> - <i - class="el-icon-files" - style="cursor: pointer;color:#42b983;margin-right: 15px" - @click="check(row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getWrkOrderSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - title="鏂囦欢涓婁紶" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="宸ュ崟淇℃伅" prop="wocode"> - <el-select - v-model="dialogForm.wocode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="devicetypecodeChange" - > - <el-option - v-for="item in workOrderArr" - :key="item.wo_code" - :label="item.wo_code" - :value="item.wo_code" - /> - </el-select> - </el-form-item> - <el-form-item label="浜у搧淇℃伅" prop="partcode"> - <el-select - v-model="dialogForm.partcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - disabled - :popper-append-to-body="false" - > - <el-option - v-for="item in partcodeArr" - :key="item.partcode" - :label="item.partname" - :value="item.partcode" - /> - </el-select> - </el-form-item> - <!-- <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">--> - <!-- <el-form-item label="鏂囦欢鍚嶇О">--> - <!-- <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> - <el-select - v-model="dialogForm.filetypecode" - style="width: 200px" - placeholder="璇烽�夋嫨" - filterable - :popper-append-to-body="false" - @change="filetypecodeChange" - > - <el-option - v-for="item in filetypeArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鐗堟湰鍙�"> - <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" /> - </el-form-item> - <el-form-item label="鏂囦欢涓婁紶" prop="Files"> - <div style="width: 200px;"> - <el-upload - ref="uploadFileRef" - style="display: inline-block;" - action="#" - :limit="1" - :show-file-list="true" - :on-exceed="handleExceed" - :auto-upload="false" - :multiple="false" - accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" - > - <!-- accept=".mp4,.pdf"--> - <el-button - v-waves - type="primary" - style="width: 200px;display: flex;justify-content: center" - icon="el-icon-upload2" - >閫夋嫨鏂囦欢 - </el-button> - </el-upload> - </div> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { WrkOrderSopAddSeave, WrkOrderSopDeleteSeave, WrkOrderSearch, WrkOrderSopMaxVersion } from '@/api/SopManager' -import { DeviceTypeSearch } from '@/api/DeviceManager' -import { EqpTypecodeSeachEqpPermissions, WrkOrderDataSelect } from '@/api/GeneralBasicData' -import waves from '@/directive/waves' -import elDragDialog from '@/directive/el-drag-dialog' -import { PartSelect } from '@/api/ProductModel' - -export default { - name: 'SopWorkOrder', - components: { - Pagination - }, - directives: { waves, elDragDialog }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� - search: '', // 鎼滅储鍏抽敭瀛� - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checked: false, - - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - wocode: '', // 璁惧绫诲瀷缂栫爜 - partcode: '', // 鐗╂枡缂栫爜 - defilename: '', - filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 - Files: '', // 鏂囦欢 - fileversion: ''// 鏂囦欢鐗堟湰鍙� - }, - dialogFormRules: { - wocode: [ - { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } - ], - partcode: [ - { required: true, message: '璇烽�夋嫨浜у搧淇℃伅', trigger: ['blur', 'change'] } - ], - defilename: [ - { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } - ], - filetypecode: [ - { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } - ] - }, - partcodeArr: [], - workOrderArr: [], - filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 - { code: 'P001', name: '浣滀笟鎸囧涔�' }, - { code: 'P002', name: '妫�楠屾寚瀵间功' }, - { code: 'P003', name: '鍥剧焊' } - ] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getWrkOrderSearch() - - this.getPartSelect() - this.getWrkOrderDataSelect() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getWrkOrderSearch() { - const res = await WrkOrderSearch(this.form) - this.tableData = res.data - this.total = res.count - }, - async getWrkOrderDataSelect() { - const { data: res } = await WrkOrderDataSelect() - this.workOrderArr = res - }, - // 鑾峰彇浜у搧淇℃伅 - async getPartSelect() { - const { data: res } = await PartSelect() - this.partcodeArr = res - }, - - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getWrkOrderSearch() - }, - // 鏌ヨ - search() { - this.getWrkOrderSearch() - }, - // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 - checkedChange(val) { - this.form.check = val ? 'Y' : 'N' - this.getWrkOrderSearch() - }, - // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 - handleExceed() { - this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') - }, - async devicetypecodeChange(val) { - const t = this.workOrderArr.find(i => i.wo_code === val) - this.dialogForm.partcode = t.materiel_code - await this.filetypecodeChange() - }, - - async filetypecodeChange() { - const data = { - wocode: this.dialogForm.wocode, - partcode: this.dialogForm.partcode, - filetypecode: this.dialogForm.filetypecode - } - const { data: res } = await WrkOrderSopMaxVersion(data) - this.dialogForm.fileversion = res - }, - // 閲嶇疆 - reset() { - this.form.search = '' - this.getWrkOrderSearch() - }, - // 鏂板鎸夐挳 - add() { - this.dialogVisible = true - }, - - // 棰勮 - async check(row) { - window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) - }, - - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const data = { - id: row.id, - wocode: row.wo, - partcode: row.materielcode, - filepath: row.filepath - } - WrkOrderSopDeleteSeave(data).then(res => { - if (res.code === '200') { - this.$message.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getWrkOrderSearch() - } - }) - }).catch(() => { - this.$message.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.wocode = '' - this.dialogForm.partcode = '' - this.dialogForm.defilename = '' - this.dialogForm.filetypecode = '' - this.dialogForm.fileversion = '' - this.dialogForm.Files = '' - this.$refs.uploadFileRef.clearFiles() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - if (!this.$refs.uploadFileRef.uploadFiles[0]) { - this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') - } - - const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 - if (!isLt100M) { - return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - const formData = new FormData() - formData.append('wocode', this.dialogForm.wocode) - formData.append('partcode', this.dialogForm.partcode) - formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) - formData.append('filetypecode', this.dialogForm.filetypecode) - formData.append('version', this.dialogForm.fileversion) - formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) - // for (var [key, value] of formData) { - // console.log(key, value) - // } - this.$store.state.app.buttonIsDisabled = true - WrkOrderSopAddSeave(formData).then(res => { - if (res.code === '200') { - this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getWrkOrderSearch() - } else { - this.$message.error('鏂囦欢涓婁紶澶辫触锛�') - this.$store.state.app.buttonIsDisabled = false - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 185 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> + <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button> + <div style="display: flex;align-items: center"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + > + <div class="elForm" style="justify-content: flex-start"> + <el-form-item style="margin-right: 30px"> + <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox> + </el-form-item> + <el-form-item> + <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" /> + </el-form-item> + </div> + </el-form> + <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ + </el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="filename" + label="鏂囦欢鍚嶇О" + min-width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filename">{{ row.filename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="filetypename" + label="鏂囦欢绫诲瀷" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.filetypename">{{ row.filetypename }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="version" + label="鐗堟湰鍙�" + min-width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.version">{{ row.version }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wo" + label="宸ュ崟鍙�" + min-width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="materielcode" + label="鐗╂枡缂栫爜" + min-width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="materielname" + label="鐗╂枡鍚嶇О" + min-width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="username" + min-width="110" + label="涓婁紶浜哄憳" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.username">{{ row.username }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="lm_date" + label="涓婁紶鏃堕棿" + min-width="160" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top"> + <i + class="el-icon-files" + style="cursor: pointer;color:#42b983;margin-right: 15px" + @click="check(row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getWrkOrderSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + title="鏂囦欢涓婁紶" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="宸ュ崟淇℃伅" prop="wocode"> + <el-select + v-model="dialogForm.wocode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="devicetypecodeChange" + > + <el-option + v-for="item in workOrderArr" + :key="item.wo_code" + :label="item.wo_code" + :value="item.wo_code" + /> + </el-select> + </el-form-item> + <el-form-item label="浜у搧淇℃伅" prop="partcode"> + <el-select + v-model="dialogForm.partcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + disabled + :popper-append-to-body="false" + > + <el-option + v-for="item in partcodeArr" + :key="item.partcode" + :label="item.partname" + :value="item.partcode" + /> + </el-select> + </el-form-item> + <!-- <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">--> + <!-- <el-form-item label="鏂囦欢鍚嶇О">--> + <!-- <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode"> + <el-select + v-model="dialogForm.filetypecode" + style="width: 200px" + placeholder="璇烽�夋嫨" + filterable + :popper-append-to-body="false" + @change="filetypecodeChange" + > + <el-option + v-for="item in filetypeArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鐗堟湰鍙�"> + <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" /> + </el-form-item> + <el-form-item label="鏂囦欢涓婁紶" prop="Files"> + <div style="width: 200px;"> + <el-upload + ref="uploadFileRef" + style="display: inline-block;" + action="#" + :limit="1" + :show-file-list="true" + :on-exceed="handleExceed" + :auto-upload="false" + :multiple="false" + accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls" + > + <!-- accept=".mp4,.pdf"--> + <el-button + v-waves + type="primary" + style="width: 200px;display: flex;justify-content: center" + icon="el-icon-upload2" + >閫夋嫨鏂囦欢 + </el-button> + </el-upload> + </div> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { WrkOrderSopAddSeave, WrkOrderSopDeleteSeave, WrkOrderSearch, WrkOrderSopMaxVersion } from '@/api/SopManager' +import { DeviceTypeSearch } from '@/api/DeviceManager' +import { EqpTypecodeSeachEqpPermissions, WrkOrderDataSelect } from '@/api/GeneralBasicData' +import waves from '@/directive/waves' +import elDragDialog from '@/directive/el-drag-dialog' +import { PartSelect } from '@/api/ProductModel' + +export default { + name: 'SopWorkOrder', + components: { + Pagination + }, + directives: { waves, elDragDialog }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈� + search: '', // 鎼滅储鍏抽敭瀛� + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checked: false, + + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + wocode: '', // 璁惧绫诲瀷缂栫爜 + partcode: '', // 鐗╂枡缂栫爜 + defilename: '', + filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜 + Files: '', // 鏂囦欢 + fileversion: ''// 鏂囦欢鐗堟湰鍙� + }, + dialogFormRules: { + wocode: [ + { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] } + ], + partcode: [ + { required: true, message: '璇烽�夋嫨浜у搧淇℃伅', trigger: ['blur', 'change'] } + ], + defilename: [ + { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] } + ], + filetypecode: [ + { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] } + ] + }, + partcodeArr: [], + workOrderArr: [], + filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍 + { code: 'P001', name: '浣滀笟鎸囧涔�' }, + { code: 'P002', name: '妫�楠屾寚瀵间功' }, + { code: 'P003', name: '鍥剧焊' } + ] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getWrkOrderSearch() + this.getPartSelect() + this.getWrkOrderDataSelect() + }, + created() { + this.getWrkOrderSearch() + + this.getPartSelect() + this.getWrkOrderDataSelect() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getWrkOrderSearch() { + const res = await WrkOrderSearch(this.form) + this.tableData = res.data + this.total = res.count + }, + async getWrkOrderDataSelect() { + const { data: res } = await WrkOrderDataSelect() + this.workOrderArr = res + }, + // 鑾峰彇浜у搧淇℃伅 + async getPartSelect() { + const { data: res } = await PartSelect() + this.partcodeArr = res + }, + + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getWrkOrderSearch() + }, + // 鏌ヨ + search() { + this.getWrkOrderSearch() + }, + // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂 + checkedChange(val) { + this.form.check = val ? 'Y' : 'N' + this.getWrkOrderSearch() + }, + // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂 + handleExceed() { + this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒') + }, + async devicetypecodeChange(val) { + const t = this.workOrderArr.find(i => i.wo_code === val) + this.dialogForm.partcode = t.materiel_code + await this.filetypecodeChange() + }, + + async filetypecodeChange() { + const data = { + wocode: this.dialogForm.wocode, + partcode: this.dialogForm.partcode, + filetypecode: this.dialogForm.filetypecode + } + const { data: res } = await WrkOrderSopMaxVersion(data) + this.dialogForm.fileversion = res + }, + // 閲嶇疆 + reset() { + this.form.search = '' + this.getWrkOrderSearch() + }, + // 鏂板鎸夐挳 + add() { + this.dialogVisible = true + }, + + // 棰勮 + async check(row) { + window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) + }, + + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const data = { + id: row.id, + wocode: row.wo, + partcode: row.materielcode, + filepath: row.filepath + } + WrkOrderSopDeleteSeave(data).then(res => { + if (res.code === '200') { + this.$message.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getWrkOrderSearch() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.wocode = '' + this.dialogForm.partcode = '' + this.dialogForm.defilename = '' + this.dialogForm.filetypecode = '' + this.dialogForm.fileversion = '' + this.dialogForm.Files = '' + this.$refs.uploadFileRef.clearFiles() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + if (!this.$refs.uploadFileRef.uploadFiles[0]) { + this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�') + } + + const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024 + if (!isLt100M) { + return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + const formData = new FormData() + formData.append('wocode', this.dialogForm.wocode) + formData.append('partcode', this.dialogForm.partcode) + formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) + formData.append('filetypecode', this.dialogForm.filetypecode) + formData.append('version', this.dialogForm.fileversion) + formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) + // for (var [key, value] of formData) { + // console.log(key, value) + // } + this.$store.state.app.buttonIsDisabled = true + WrkOrderSopAddSeave(formData).then(res => { + if (res.code === '200') { + this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getWrkOrderSearch() + } else { + this.$message.error('鏂囦欢涓婁紶澶辫触锛�') + this.$store.state.app.buttonIsDisabled = false + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 185 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/defectDetailList.vue b/src/views/statistic/defectDetailList.vue index 858d425..ac48102 100644 --- a/src/views/statistic/defectDetailList.vue +++ b/src/views/statistic/defectDetailList.vue @@ -1,607 +1,612 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> - <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缂洪櫡浠g爜" style=" display: flex;"> - <el-input v-model="form.defectcode" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缂洪櫡鍚嶇О" style=" display: flex;"> - <el-input v-model="form.defectname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="socode"--> - <!-- label="閿�鍞崟鍙�"--> - <!-- width="160"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="plan_qty" - label="浠诲姟鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="defect_qty" - label="涓嶈壇鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="defect_code" - label="缂洪櫡浠g爜" - width="110" - sortable="custom" - /> - <el-table-column - prop="defect_name" - label="缂洪櫡鍚嶇О" - width="110" - sortable="custom" - /> - <el-table-column - prop="style" - label="鎿嶄綔绫诲瀷" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.style==='B'">鎶ュ伐</div> - <div v-if="row.style==='S'">鏀舵枡</div> - </template> - </el-table-column> - <el-table-column - prop="lm_user" - label="鎿嶄綔浜哄憳" - width="110" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鎿嶄綔鏃堕棿" - width="160" - sortable="custom" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDefectDetailsReportSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> - <el-tag - v-for="tag in tagArr" - :key="tag.name" - type="success" - style="margin-right: 15px;min-width: 80px;text-align: center" - > - {{ tag }} - </el-tag> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { handleDatetime, validateCode } from '@/utils/global' -import { - DefectDetailsReportExcelSearch, - DefectDetailsReportSearch, - GroupSalaryReportSearchUser -} from '@/api/ReportManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'DefectDetailList', - components: { - Pagination, ImportPicker - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - - wkshopcode: '', - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - stepname: '', // 宸ュ簭鍚嶇О - defectcode: '', // 缂洪櫡浠g爜 - defectname: '', // 缂洪櫡鍚嶇О - reportname: '', // 鎿嶄綔浜哄憳 - reportdate: '', // 鎿嶄綔鏃堕棿 - prop: 'partcode', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - // groupArr: [], - wkshopcodeArr: [], - total: 10, - tableData: [], - dialogVisible: false, - tagArr: [], // - dialogForm: { - OrgType: '', - OrgCode: '', - OrgName: '', - SupUnit: ''// 涓婄骇鍗曚綅 - }, - operation: '', - dialogFormRules: { - OrgType: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - OrgCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrgName: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDefectDetailsReportSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - handleRequest() { - this.getDefectDetailsReportSearch().then(res => { - if (res.code === '200') { - this.getPrentOrganizationNoCompany() - } - }) - }, - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - async getDefectDetailsReportSearch() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - defectcode: this.form.defectcode, - defectname: this.form.defectname, - reportname: this.form.reportname, - reportdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - - const res = await DefectDetailsReportSearch(data) - this.tableData = res.data - this.total = res.count - - return { code: res.code } - }, - - // async getMesOrderStepReportSelectUserGroup() { - // const { data: res } = await MesOrderStepReportSelectUserGroup() - // this.groupArr = res - // }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDefectDetailsReportSearch() - }, - async download() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - defectcode: this.form.defectcode, - defectname: this.form.defectname, - reportname: this.form.reportname, - reportdate: tempDate - } - - const { data: res } = await DefectDetailsReportExcelSearch(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getDefectDetailsReportSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.defectcode = '' - this.form.defectname = '' - this.form.reportname = '' - this.form.reportdate = '' - this.getDefectDetailsReportSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await GroupSalaryReportSearchUser({ id: row.id }) - this.tagArr = res.data.map(r => r.reportname) - // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - // confirmButtonText: '纭畾', - // cancelButtonText: '鍙栨秷', - // type: 'warning' - // }).then(() => { - // DeleteOrganization({ orgid: row.code }).then(res => { - // if (res.code === '200') { - // this.$message.success('鍒犻櫎鎴愬姛!') - // if (this.form.page > 1 && this.tableData.length === 1) { - // this.form.page-- - // } - // this.getDefectDetailsReportSearch() - // } - // }) - // }).catch(() => { - // this.$message.info('宸插彇娑堝垹闄�') - // }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrgType = '' - this.dialogForm.OrgCode = '' - this.dialogForm.OrgName = '' - this.dialogForm.SupUnit = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - // AddUpdateOrganization(data).then(res => { - // if (res.code === '200') { - // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - // this.dialogVisible = false - // this.getDefectDetailsReportSearch() - // } else { - // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - // } - // }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 295 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText{ - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> + <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缂洪櫡浠g爜" style=" display: flex;"> + <el-input v-model="form.defectcode" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缂洪櫡鍚嶇О" style=" display: flex;"> + <el-input v-model="form.defectname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="socode"--> + <!-- label="閿�鍞崟鍙�"--> + <!-- width="160"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="plan_qty" + label="浠诲姟鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="defect_qty" + label="涓嶈壇鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="defect_code" + label="缂洪櫡浠g爜" + width="110" + sortable="custom" + /> + <el-table-column + prop="defect_name" + label="缂洪櫡鍚嶇О" + width="110" + sortable="custom" + /> + <el-table-column + prop="style" + label="鎿嶄綔绫诲瀷" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.style==='B'">鎶ュ伐</div> + <div v-if="row.style==='S'">鏀舵枡</div> + </template> + </el-table-column> + <el-table-column + prop="lm_user" + label="鎿嶄綔浜哄憳" + width="110" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鎿嶄綔鏃堕棿" + width="160" + sortable="custom" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDefectDetailsReportSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> + <el-tag + v-for="tag in tagArr" + :key="tag.name" + type="success" + style="margin-right: 15px;min-width: 80px;text-align: center" + > + {{ tag }} + </el-tag> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { handleDatetime, validateCode } from '@/utils/global' +import { + DefectDetailsReportExcelSearch, + DefectDetailsReportSearch, + GroupSalaryReportSearchUser +} from '@/api/ReportManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'DefectDetailList', + components: { + Pagination, ImportPicker + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + + wkshopcode: '', + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + stepname: '', // 宸ュ簭鍚嶇О + defectcode: '', // 缂洪櫡浠g爜 + defectname: '', // 缂洪櫡鍚嶇О + reportname: '', // 鎿嶄綔浜哄憳 + reportdate: '', // 鎿嶄綔鏃堕棿 + prop: 'partcode', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + // groupArr: [], + wkshopcodeArr: [], + total: 10, + tableData: [], + dialogVisible: false, + tagArr: [], // + dialogForm: { + OrgType: '', + OrgCode: '', + OrgName: '', + SupUnit: ''// 涓婄骇鍗曚綅 + }, + operation: '', + dialogFormRules: { + OrgType: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + OrgCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrgName: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDefectDetailsReportSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + handleRequest() { + this.getDefectDetailsReportSearch().then(res => { + if (res.code === '200') { + this.getPrentOrganizationNoCompany() + } + }) + }, + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + async getDefectDetailsReportSearch() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + defectcode: this.form.defectcode, + defectname: this.form.defectname, + reportname: this.form.reportname, + reportdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + + const res = await DefectDetailsReportSearch(data) + this.tableData = res.data + this.total = res.count + + return { code: res.code } + }, + + // async getMesOrderStepReportSelectUserGroup() { + // const { data: res } = await MesOrderStepReportSelectUserGroup() + // this.groupArr = res + // }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDefectDetailsReportSearch() + }, + async download() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + defectcode: this.form.defectcode, + defectname: this.form.defectname, + reportname: this.form.reportname, + reportdate: tempDate + } + + const { data: res } = await DefectDetailsReportExcelSearch(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getDefectDetailsReportSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.defectcode = '' + this.form.defectname = '' + this.form.reportname = '' + this.form.reportdate = '' + this.getDefectDetailsReportSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await GroupSalaryReportSearchUser({ id: row.id }) + this.tagArr = res.data.map(r => r.reportname) + // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + // confirmButtonText: '纭畾', + // cancelButtonText: '鍙栨秷', + // type: 'warning' + // }).then(() => { + // DeleteOrganization({ orgid: row.code }).then(res => { + // if (res.code === '200') { + // this.$message.success('鍒犻櫎鎴愬姛!') + // if (this.form.page > 1 && this.tableData.length === 1) { + // this.form.page-- + // } + // this.getDefectDetailsReportSearch() + // } + // }) + // }).catch(() => { + // this.$message.info('宸插彇娑堝垹闄�') + // }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrgType = '' + this.dialogForm.OrgCode = '' + this.dialogForm.OrgName = '' + this.dialogForm.SupUnit = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + // AddUpdateOrganization(data).then(res => { + // if (res.code === '200') { + // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + // this.dialogVisible = false + // this.getDefectDetailsReportSearch() + // } else { + // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + // } + // }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 295 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText{ + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/groupSalaryList.vue b/src/views/statistic/groupSalaryList.vue index 60e4928..bf026a7 100644 --- a/src/views/statistic/groupSalaryList.vue +++ b/src/views/statistic/groupSalaryList.vue @@ -1,917 +1,922 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - - <!-- <div--> - <!-- style="color: red;margin: 10px 5px 0 0;"--> - <!-- >褰撳墠鎶ヨ〃鍙粺璁¤嚜鍒朵欢宸ュ簭--> - <!-- </div>--> - - <!-- <div class="topRight" style="display: flex;align-items: center">--> - <!-- <el-select--> - <!-- v-model="form.rejectstepcode"--> - <!-- style="width: 170px;"--> - <!-- multiple--> - <!-- placeholder="璇烽�夋嫨鍓旈櫎宸ュ簭"--> - <!-- collapse-tags--> - <!-- filterable--> - <!-- clearable--> - <!-- @change="getGroupSalaryReportSearch"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in StepSelectArr"--> - <!-- :key="item.stepcode"--> - <!-- :label="item.stepname"--> - <!-- :value="item.stepcode"--> - <!-- />--> - <!-- </el-select>--> - <!-- </div>--> - - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="閿�鍞崟鍙�" style="display: flex;"> - <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style="display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <!-- <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">--> - <!-- <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />--> - <!-- </el-form-item>--> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style="display: flex;"> - <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鐢熶骇鐝粍" style=" display: flex;"> - <el-select v-model="form.groupcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in groupArr" - :key="item.usergroupcode" - :label="item.usergroupname" - :value="item.usergroupcode" - /> - </el-select> - </el-form-item> - <!-- <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;">--> - <!-- <el-input v-model="form.username" style="width: 200px" placeholder="璇疯緭鍏�" />--> - <!-- </el-form-item>--> - <el-form-item v-show="isExpandForm" label="鎿嶄綔鏃堕棿" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.operdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - - </div> - <el-tabs type="border-card" style="margin-top: 10px" @tab-click="tabClick"> - <el-tab-pane label="鏈亾宸ュ簭"> - <div class="elTableDiv" style="margin: 0 auto 10px;"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?(tableHeight-70):(tableHeight-30)+'px'" - border - :summary-method="getSummaries" - show-summary - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?(tableHeight-70):(tableHeight-30)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <el-table-column - prop="saleOrderCode" - label="閿�鍞崟鍙�" - width="160" - sortable="custom" - /> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="150" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="鐢熶骇杞﹂棿" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="usergroupname" - label="鐢熶骇鐝粍" - width="110" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.usergroupname">{{ row.usergroupname }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="good_qty" - label="鎶ュ伐鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="unprice" - label="宸ュ簭鍗曚环" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.unprice">{{ row.unprice }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="usermoney" - label="璁′欢宸ヨ祫" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.usermoney">{{ row.usermoney }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="lm_user" - label="鎿嶄綔浜�" - width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎿嶄綔鏃堕棿" - width="160" - sortable="custom" - /> - - <el-table-column - label="鏌ョ湅鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="浜哄憳鏄庣粏" placement="top"> - <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </el-tooltip> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i class="el-icon-delete" @click="del(row)" />--> - <!-- </el-tooltip>--> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getGroupSalaryReportSearch" - /> - </el-tab-pane> - <el-tab-pane label="閫愰亾宸ュ簭"> - <div class="elTableDiv" style="margin: 0 auto 10px;"> - <el-table - ref="tableDataRef2" - class="tableFixed" - :data="tableData2" - :height="isExpandForm?(tableHeight-70):(tableHeight-30)+'px'" - border - :summary-method="getSummaries" - show-summary - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?(tableHeight-70):(tableHeight-30)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <el-table-column - prop="saleOrderCode" - label="閿�鍞崟鍙�" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="150" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="鐢熶骇杞﹂棿" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="usergroupname" - label="鐢熶骇鐝粍" - width="110" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.usergroupname">{{ row.usergroupname }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="good_qty" - label="鎶ュ伐鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="unprice" - label="宸ュ簭鍗曚环" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.unprice">{{ row.unprice }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="usermoney" - label="璁′欢宸ヨ祫" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.usermoney">{{ row.usermoney }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="lm_user" - label="鎿嶄綔浜�" - width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎿嶄綔鏃堕棿" - width="160" - sortable="custom" - /> - - <el-table-column - label="鏌ョ湅鏄庣粏" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="浜哄憳鏄庣粏" placement="top"> - <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> - <i - class="el-icon-tickets" - :style="{color:$store.state.settings.theme}" - style="cursor: pointer;margin-right: 15px" - @click="edit('edit',row)" - /> - </el-tooltip> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i class="el-icon-delete" @click="del(row)" />--> - <!-- </el-tooltip>--> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getGroupSalaryReportSearch" - /> - </el-tab-pane> - </el-tabs> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> - <el-tag - v-for="tag in tagArr" - :key="tag.name" - type="success" - style="margin-right: 15px;min-width: 80px;text-align: center" - :style="{color:$store.state.settings.theme}" - > - {{ tag }} - </el-tag> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { handleDatetime, validateCode } from '@/utils/global' -import { - GroupSalaryReportExcelSearch, - GroupSalaryReportSearch, - GroupSalaryReportSearchUser -} from '@/api/ReportManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { GroupsPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'GroupSalaryList', - components: { - Pagination, ImportPicker - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - StepSelectArr: [], // 鍓旈櫎宸ュ簭鏁扮粍 - form: { - socode: '', - wkshopcode: '', - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - stepname: '', // 宸ュ簭鍚嶇О - groupcode: '', // 鐢熶骇鐝粍 - username: '', // 鎿嶄綔浜哄憳 - operdate: '', // 鎿嶄綔鏃堕棿 - rejectstepcode: [], // 鍓旈櫎宸ュ簭(鍥哄畾钖祫宸ュ簭涓嶅弬涓庤绠� - compute: 'last', // 璁′欢鏂瑰紡 閫愰亾宸ュ簭锛歝ontin 鏈亾宸ュ簭锛歭ast - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopcodeArr: [], - groupArr: [], - total: 10, - tableData: [], - tableData2: [], - dialogVisible: false, - tagArr: [], // - dialogForm: { - OrgType: '', - OrgCode: '', - OrgName: '', - SupUnit: ''// 涓婄骇鍗曚綅 - }, - operation: '', - dialogFormRules: { - OrgType: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - OrgCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrgName: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getGroupSalaryReportSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - // updated() { - // this.$nextTick(() => { - // this.$refs.tableDataRef.doLayout() - // this.$refs.tableDataRef2.doLayout() - // }) - // }, - methods: { - handleRequest() { - this.getGroupSalaryReportSearch().then(res => { - if (res.code === '200') { - this.getMesOrderStepReportSelectUserGroup() - this.getPrentOrganizationNoCompany() - // this.getStepSelect() - } - }) - }, - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - // 鑾峰彇宸ュ簭涓嬫媺鎺ュ彛 - // async getStepSelect() { - // const { data: res } = await StepSelect() - // this.StepSelectArr = res - // }, - getSummaries(param) { - const { columns, data } = param - const sums = [] - - columns.forEach((column, index) => { - if (index === 10) { - sums[index] = '鎬讳环' - return - } - const values = data.map(item => Number(item[column.property])) - if (column.property === 'usermoney') { - sums[index] = values.reduce((prev, curr) => { - const value = Number(curr) - if (!isNaN(value)) { - return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 - } else { - return Math.round(prev * 100) / 100 - } - }, 0) - sums[index] = sums[index].toFixed(2) + ' 鍏�' - } else { - // sums[index] = 'N/A' - sums[index] = ' ' - } - }) - this.$nextTick(() => { - this.$refs.tableDataRef.doLayout() - this.$refs.tableDataRef2.doLayout() - }) - - return sums - }, - async getGroupSalaryReportSearch() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - socode: this.form.socode, - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - groupcode: this.form.groupcode, - username: this.form.username, - operdate: tempDate, - rejectstepcode: this.form.rejectstepcode.join(','), - compute: this.form.compute, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - const res = await GroupSalaryReportSearch(data) - if (this.form.compute === 'last') { - this.tableData = res.data - } - if (this.form.compute === 'contin') { - this.tableData2 = res.data - } - - this.total = res.count - - return { code: res.code } - }, - - async getMesOrderStepReportSelectUserGroup() { - const { data: res } = await GroupsPermissions() - this.groupArr = res - }, - tabClick(val) { - // console.log(val.label) - this.form.compute = val.label === '鏈亾宸ュ簭' ? 'last' : 'contin' - this.getGroupSalaryReportSearch() - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getGroupSalaryReportSearch() - }, - async download() { - let tempDate = this.form.operdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - socode: this.form.socode, - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - groupcode: this.form.groupcode, - username: this.form.username, - operdate: tempDate, - compute: this.form.compute - } - - const { data: res } = await GroupSalaryReportExcelSearch(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getGroupSalaryReportSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.socode = '' - this.form.wkshopcode = '' - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.groupcode = '' - this.form.username = '' - this.form.operdate = '' - this.getGroupSalaryReportSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await GroupSalaryReportSearchUser({ id: row.id }) - this.tagArr = res.data.map(r => r.username).join(',').split(',') - // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - // confirmButtonText: '纭畾', - // cancelButtonText: '鍙栨秷', - // type: 'warning' - // }).then(() => { - // DeleteOrganization({ orgid: row.code }).then(res => { - // if (res.code === '200') { - // this.$message.success('鍒犻櫎鎴愬姛!') - // if (this.form.page > 1 && this.tableData.length === 1) { - // this.form.page-- - // } - // this.getGroupSalaryReportSearch() - // } - // }) - // }).catch(() => { - // this.$message.info('宸插彇娑堝垹闄�') - // }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrgType = '' - this.dialogForm.OrgCode = '' - this.dialogForm.OrgName = '' - this.dialogForm.SupUnit = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - // AddUpdateOrganization(data).then(res => { - // if (res.code === '200') { - // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - // this.dialogVisible = false - // this.getGroupSalaryReportSearch() - // } else { - // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - // } - // }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - this.$refs.tableDataRef2.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + + <!-- <div--> + <!-- style="color: red;margin: 10px 5px 0 0;"--> + <!-- >褰撳墠鎶ヨ〃鍙粺璁¤嚜鍒朵欢宸ュ簭--> + <!-- </div>--> + + <!-- <div class="topRight" style="display: flex;align-items: center">--> + <!-- <el-select--> + <!-- v-model="form.rejectstepcode"--> + <!-- style="width: 170px;"--> + <!-- multiple--> + <!-- placeholder="璇烽�夋嫨鍓旈櫎宸ュ簭"--> + <!-- collapse-tags--> + <!-- filterable--> + <!-- clearable--> + <!-- @change="getGroupSalaryReportSearch"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in StepSelectArr"--> + <!-- :key="item.stepcode"--> + <!-- :label="item.stepname"--> + <!-- :value="item.stepcode"--> + <!-- />--> + <!-- </el-select>--> + <!-- </div>--> + + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="閿�鍞崟鍙�" style="display: flex;"> + <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style="display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <!-- <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">--> + <!-- <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />--> + <!-- </el-form-item>--> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style="display: flex;"> + <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鐢熶骇鐝粍" style=" display: flex;"> + <el-select v-model="form.groupcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in groupArr" + :key="item.usergroupcode" + :label="item.usergroupname" + :value="item.usergroupcode" + /> + </el-select> + </el-form-item> + <!-- <el-form-item v-show="isExpandForm" label="鎿嶄綔浜哄憳" style=" display: flex;">--> + <!-- <el-input v-model="form.username" style="width: 200px" placeholder="璇疯緭鍏�" />--> + <!-- </el-form-item>--> + <el-form-item v-show="isExpandForm" label="鎿嶄綔鏃堕棿" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.operdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + + </div> + <el-tabs type="border-card" style="margin-top: 10px" @tab-click="tabClick"> + <el-tab-pane label="鏈亾宸ュ簭"> + <div class="elTableDiv" style="margin: 0 auto 10px;"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?(tableHeight-70):(tableHeight-30)+'px'" + border + :summary-method="getSummaries" + show-summary + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?(tableHeight-70):(tableHeight-30)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <el-table-column + prop="saleOrderCode" + label="閿�鍞崟鍙�" + width="160" + sortable="custom" + /> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="150" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="鐢熶骇杞﹂棿" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="usergroupname" + label="鐢熶骇鐝粍" + width="110" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.usergroupname">{{ row.usergroupname }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="good_qty" + label="鎶ュ伐鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="unprice" + label="宸ュ簭鍗曚环" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.unprice">{{ row.unprice }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="usermoney" + label="璁′欢宸ヨ祫" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.usermoney">{{ row.usermoney }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="lm_user" + label="鎿嶄綔浜�" + width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎿嶄綔鏃堕棿" + width="160" + sortable="custom" + /> + + <el-table-column + label="鏌ョ湅鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="浜哄憳鏄庣粏" placement="top"> + <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </el-tooltip> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i class="el-icon-delete" @click="del(row)" />--> + <!-- </el-tooltip>--> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getGroupSalaryReportSearch" + /> + </el-tab-pane> + <el-tab-pane label="閫愰亾宸ュ簭"> + <div class="elTableDiv" style="margin: 0 auto 10px;"> + <el-table + ref="tableDataRef2" + class="tableFixed" + :data="tableData2" + :height="isExpandForm?(tableHeight-70):(tableHeight-30)+'px'" + border + :summary-method="getSummaries" + show-summary + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?(tableHeight-70):(tableHeight-30)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <el-table-column + prop="saleOrderCode" + label="閿�鍞崟鍙�" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="150" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="鐢熶骇杞﹂棿" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="usergroupname" + label="鐢熶骇鐝粍" + width="110" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.usergroupname">{{ row.usergroupname }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="good_qty" + label="鎶ュ伐鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="unprice" + label="宸ュ簭鍗曚环" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.unprice">{{ row.unprice }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="usermoney" + label="璁′欢宸ヨ祫" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.usermoney">{{ row.usermoney }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="lm_user" + label="鎿嶄綔浜�" + width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎿嶄綔鏃堕棿" + width="160" + sortable="custom" + /> + + <el-table-column + label="鏌ョ湅鏄庣粏" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="浜哄憳鏄庣粏" placement="top"> + <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> + <i + class="el-icon-tickets" + :style="{color:$store.state.settings.theme}" + style="cursor: pointer;margin-right: 15px" + @click="edit('edit',row)" + /> + </el-tooltip> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i class="el-icon-delete" @click="del(row)" />--> + <!-- </el-tooltip>--> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getGroupSalaryReportSearch" + /> + </el-tab-pane> + </el-tabs> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> + <el-tag + v-for="tag in tagArr" + :key="tag.name" + type="success" + style="margin-right: 15px;min-width: 80px;text-align: center" + :style="{color:$store.state.settings.theme}" + > + {{ tag }} + </el-tag> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { handleDatetime, validateCode } from '@/utils/global' +import { + GroupSalaryReportExcelSearch, + GroupSalaryReportSearch, + GroupSalaryReportSearchUser +} from '@/api/ReportManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { GroupsPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'GroupSalaryList', + components: { + Pagination, ImportPicker + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + StepSelectArr: [], // 鍓旈櫎宸ュ簭鏁扮粍 + form: { + socode: '', + wkshopcode: '', + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + stepname: '', // 宸ュ簭鍚嶇О + groupcode: '', // 鐢熶骇鐝粍 + username: '', // 鎿嶄綔浜哄憳 + operdate: '', // 鎿嶄綔鏃堕棿 + rejectstepcode: [], // 鍓旈櫎宸ュ簭(鍥哄畾钖祫宸ュ簭涓嶅弬涓庤绠� + compute: 'last', // 璁′欢鏂瑰紡 閫愰亾宸ュ簭锛歝ontin 鏈亾宸ュ簭锛歭ast + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopcodeArr: [], + groupArr: [], + total: 10, + tableData: [], + tableData2: [], + dialogVisible: false, + tagArr: [], // + dialogForm: { + OrgType: '', + OrgCode: '', + OrgName: '', + SupUnit: ''// 涓婄骇鍗曚綅 + }, + operation: '', + dialogFormRules: { + OrgType: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + OrgCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrgName: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getGroupSalaryReportSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + // updated() { + // this.$nextTick(() => { + // this.$refs.tableDataRef.doLayout() + // this.$refs.tableDataRef2.doLayout() + // }) + // }, + methods: { + handleRequest() { + this.getGroupSalaryReportSearch().then(res => { + if (res.code === '200') { + this.getMesOrderStepReportSelectUserGroup() + this.getPrentOrganizationNoCompany() + // this.getStepSelect() + } + }) + }, + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + // 鑾峰彇宸ュ簭涓嬫媺鎺ュ彛 + // async getStepSelect() { + // const { data: res } = await StepSelect() + // this.StepSelectArr = res + // }, + getSummaries(param) { + const { columns, data } = param + const sums = [] + + columns.forEach((column, index) => { + if (index === 10) { + sums[index] = '鎬讳环' + return + } + const values = data.map(item => Number(item[column.property])) + if (column.property === 'usermoney') { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 + } else { + return Math.round(prev * 100) / 100 + } + }, 0) + sums[index] = sums[index].toFixed(2) + ' 鍏�' + } else { + // sums[index] = 'N/A' + sums[index] = ' ' + } + }) + this.$nextTick(() => { + this.$refs.tableDataRef.doLayout() + this.$refs.tableDataRef2.doLayout() + }) + + return sums + }, + async getGroupSalaryReportSearch() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + socode: this.form.socode, + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + groupcode: this.form.groupcode, + username: this.form.username, + operdate: tempDate, + rejectstepcode: this.form.rejectstepcode.join(','), + compute: this.form.compute, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + const res = await GroupSalaryReportSearch(data) + if (this.form.compute === 'last') { + this.tableData = res.data + } + if (this.form.compute === 'contin') { + this.tableData2 = res.data + } + + this.total = res.count + + return { code: res.code } + }, + + async getMesOrderStepReportSelectUserGroup() { + const { data: res } = await GroupsPermissions() + this.groupArr = res + }, + tabClick(val) { + // console.log(val.label) + this.form.compute = val.label === '鏈亾宸ュ簭' ? 'last' : 'contin' + this.getGroupSalaryReportSearch() + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getGroupSalaryReportSearch() + }, + async download() { + let tempDate = this.form.operdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + socode: this.form.socode, + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + groupcode: this.form.groupcode, + username: this.form.username, + operdate: tempDate, + compute: this.form.compute + } + + const { data: res } = await GroupSalaryReportExcelSearch(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getGroupSalaryReportSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.socode = '' + this.form.wkshopcode = '' + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.groupcode = '' + this.form.username = '' + this.form.operdate = '' + this.getGroupSalaryReportSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await GroupSalaryReportSearchUser({ id: row.id }) + this.tagArr = res.data.map(r => r.username).join(',').split(',') + // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + // confirmButtonText: '纭畾', + // cancelButtonText: '鍙栨秷', + // type: 'warning' + // }).then(() => { + // DeleteOrganization({ orgid: row.code }).then(res => { + // if (res.code === '200') { + // this.$message.success('鍒犻櫎鎴愬姛!') + // if (this.form.page > 1 && this.tableData.length === 1) { + // this.form.page-- + // } + // this.getGroupSalaryReportSearch() + // } + // }) + // }).catch(() => { + // this.$message.info('宸插彇娑堝垹闄�') + // }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrgType = '' + this.dialogForm.OrgCode = '' + this.dialogForm.OrgName = '' + this.dialogForm.SupUnit = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + // AddUpdateOrganization(data).then(res => { + // if (res.code === '200') { + // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + // this.dialogVisible = false + // this.getGroupSalaryReportSearch() + // } else { + // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + // } + // }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + this.$refs.tableDataRef2.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/installationLampList.vue b/src/views/statistic/installationLampList.vue index 636dc74..c4b862a 100644 --- a/src/views/statistic/installationLampList.vue +++ b/src/views/statistic/installationLampList.vue @@ -1,955 +1,960 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div v-show="currentTabPositionName==='瀹夌伅鏄庣粏'" class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> - <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in wkshopSelectArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="鍛煎彨绫诲瀷" style=" display: flex;"> - <el-select v-model="form.calltypecode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in calltypeSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鍛煎彨浜哄憳" style=" display: flex;"> - <el-input v-model="form.calluser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍛煎彨鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> - <el-date-picker - v-model="form.calldate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="璁惧缂栫爜" style=" display: flex;"> - <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="璁惧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.eqpname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鍝嶅簲浜哄憳" style=" display: flex;"> - <el-input v-model="form.responduser" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鍝嶅簲鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> - <el-date-picker - v-model="form.responddate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div v-show="currentTabPositionName==='瀹夌伅姹囨��'" class="bodyTopFormGroup"> - <el-form - ref="formSum" - :model="formSum" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> - <el-select - v-model="formSum.wkshopcode" - style="width: 200px" - placeholder="璇烽�夋嫨" - @change="getWhkspIsEqpSearch" - > - <el-option - v-for="item in wkshopSelectArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="鐢熶骇璁惧" style=" display: flex;"> - <el-select - v-model="formSum.eqpcode" - :disabled="formSum.wkshopcode===''" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in devicetypeArr" - :key="item.eqp_code" - :label="item.eqp_name" - :value="item.eqp_code" - /> - </el-select> - </el-form-item> - <el-form-item label="鍛煎彨绫诲瀷" style=" display: flex;"> - <el-select v-model="formSum.calltypecode" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in calltypeSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鍛煎彨鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> - <el-date-picker - v-model="formSum.calldate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - <el-form-item - v-show="isExpandForm" - label="鍝嶅簲鏃堕棿" - style="display: flex;font-size: 14px;align-items: center" - > - <el-date-picker - v-model="formSum.responddate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <el-tabs - ref="elTabsRef" - type="border-card" - :style="{height:isExpandForm?tableHeight+'px':(tableHeight+40)+'px'}" - @tab-click="tabClick" - > - <el-tab-pane label="瀹夌伅鏄庣粏"> - <div class="elTableDiv"> - <TableColumnSettings - v-if="false" - :list1="tableColumnSettingsArray" - @tableColumnUpdate="tableColumnUpdate" - /> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - class="tableFixed" - :data="tableData" - border - :height="isExpandForm?(tableHeight-130):(tableHeight-90)+'px'" - :row-class-name="tableRowClassName" - :style="{width: 100+'%' ,height:isExpandForm?(tableHeight-130):(tableHeight-90)+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='status'"> - <div v-if="row.status==='宸插搷搴�'" style="display: flex;align-items: center"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 宸插搷搴� - </div> - <div v-if="row.status==='寰呭搷搴�'" style="display: flex;align-items: center"> - <i class="el-icon-info" style="margin-right: 2px" /> - 寰呭搷搴� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getAnDonReportDefinitSearch" - /> - </el-tab-pane> - <el-tab-pane label="瀹夌伅姹囨��"> - <div class="elTableDiv"> - <TableColumnSettings - v-if="false" - :list1="tableColumnSettingsArray2" - @tableColumnUpdate="tableColumnUpdate2" - /> - <el-table - ref="tableDataRef2" - :key="tableTimeStampKey2" - class="tableFixed" - :data="tableDataSum" - border - :height="isExpandForm?(tableHeight-130):(tableHeight-90)+'px'" - :row-class-name="tableRowClassName" - :style="{width: 100+'%' ,height:isExpandForm?(tableHeight-130):(tableHeight-90)+'px'}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray2" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='repondtime'"> - {{ row.repondtime }} 鍒嗛挓 - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="totalSum" - :page.sync="formSum.page" - :limit.sync="formSum.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getAnDonReportDefinitSearch" - /> - </el-tab-pane> - </el-tabs> - - </div> - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { AnDengTypeSearch, WhkspIsEqpSearch } from '@/api/basicSettings' -import { handleDatetime } from '@/utils/global' -import { - AnDonReportDefinitExcelSearch, - AnDonReportDefinitSearch, - AnDonReportSumExcelSearch, - AnDonReportSumSearch -} from '@/api/ReportManager' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' -import { PrentOrganization } from '@/api/GeneralBasicData' - -export default { - name: 'InstallationLampList', - components: { - Pagination, TableColumnSettings - }, - directives: { waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - wkshopcode: '', // 杞﹂棿缂栫爜 - calltypecode: '', // 鍛煎彨绫诲瀷缂栫爜 - calluser: '', // 鍛煎彨浜哄憳 - calldate: '', // 鍛煎彨鏃堕棿 - eqpcode: '', // 璁惧缂栫爜 - eqpname: '', // 璁惧鍚嶇О - responduser: '', // 鍝嶅簲浜哄憳 - responddate: '', // 鍝嶅簲鏃堕棿 - prop: 'eqp_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - wkshopSelectArr: [], // 鐢熶骇杞﹂棿涓嬫媺鏁扮粍 - calltypeSelectArr: [], // 鍛煎彨绫诲瀷涓嬫媺鏁扮粍 - tableData: [], - tableColumnSettingsArray: [ - // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'wkshp_code', - label: '杞﹂棿缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'wkshp_name', - label: '杞﹂棿鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_code', - label: '璁惧缂栫爜', - id: 5, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'eqp_name', - label: '璁惧鍚嶇О', - id: 6, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'typename', - label: '鍛煎彨绫诲瀷', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'start_user', - label: '鍛煎彨浜�', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 160, - width: false, - prop: 'start_date', - label: '鍛煎彨鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'resp_user', - label: '鍝嶅簲浜�', - id: 10, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 160, - width: false, - prop: 'resp_date', - label: '鍝嶅簲鏃堕棿', - id: 11, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 130, - width: false, - prop: 'respondcont', - label: '鍝嶅簲鏃堕暱', - id: 12, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'status', - label: '鐘舵��', - id: 13, - show: true, - fixed: 'right', - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - currentTabPositionName: '瀹夌伅鏄庣粏', // Tab鏍囩浣嶄簬鐨勪綅缃� 榛樿绗��0鈥欎釜 - formSum: { - wkshopcode: '', // 杞﹂棿缂栫爜 - calltypecode: '', // 鍛煎彨绫诲瀷缂栫爜 - calldate: '', // 鍛煎彨鏃堕棿 - eqpcode: '', // 璁惧缂栫爜 - responddate: '', // 鍝嶅簲鏃堕棿 - prop: 'eqp_code', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - tableDataSum: [], - totalSum: 0, - tableColumnSettingsArray2: [ - // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: 25, width: 50, prop: 'RowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'wkshp_name', - label: '鐢熶骇杞﹂棿', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_code', - label: '璁惧缂栫爜', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'eqp_name', - label: '璁惧鍚嶇О', - id: 5, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'calltypename', - label: '鍛煎彨绫诲瀷', - id: 6, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'callcount', - label: '鍛煎彨鎬绘鏁�', - id: 7, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'repondcount', - label: '鍝嶅簲鎬绘鏁�', - id: 8, - show: true, - fixed: false, - sortable: true - }, { - minWidth: 110, - width: false, - prop: 'repondtime', - label: '鎬诲搷搴旀椂闀�', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey2: new Date().getTime(), // 琛ㄦ牸key - - devicetypeArr: []// 鐢熶骇璁惧涓嬫媺鏁扮粍 - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - this.$refs.tableDataRef.doLayout() - }, - tableColumnUpdate2(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray2 = val - } - this.tableTimeStampKey2 = new Date().getTime() - this.$refs.tableDataRef2.doLayout() - }, - handleRequest() { - this.getAnDonReportDefinitSearch().then(res => { - if (res.code === '200') { - this.getShopSearch() - this.getAnDengTypeSearch() - } - }) - }, - async getAnDonReportDefinitSearch() { - let tempDate = this.form.calldate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - let tempDate2 = this.form.responddate - if (tempDate2.length > 0) { - tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1]) - } - - const data = { - wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 - calltypecode: this.form.calltypecode, // 鍛煎彨绫诲瀷缂栫爜 - calluser: this.form.calluser, // 鍛煎彨浜哄憳 - calldate: tempDate, // 鍛煎彨鏃堕棿 - eqpcode: this.form.eqpcode, // 璁惧缂栫爜 - eqpname: this.form.eqpname, // 璁惧鍚嶇О - responduser: this.form.responduser, // 鍝嶅簲浜哄憳 - responddate: tempDate2, // 鍝嶅簲鏃堕棿 - prop: this.form.prop, // 鎺掑簭瀛楁 - order: this.form.order, // 鎺掑簭瀛楁 - page: this.form.page, // 绗嚑椤� - rows: this.form.rows // 姣忛〉澶氬皯鏉� - } - - const res = await AnDonReportDefinitSearch(data) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - async getAnDonReportSumSearch() { - let tempDate = this.formSum.calldate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - let tempDate2 = this.formSum.responddate - if (tempDate2.length > 0) { - tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1]) - } - - const data = { - wkshopcode: this.formSum.wkshopcode, // 杞﹂棿缂栫爜 - calltypecode: this.formSum.calltypecode, // 鍛煎彨绫诲瀷缂栫爜 - calldate: tempDate, // 鍛煎彨鏃堕棿 - eqpcode: this.formSum.eqpcode, // 璁惧缂栫爜 - responddate: tempDate2, // 鍝嶅簲鏃堕棿 - prop: this.formSum.prop, // 鎺掑簭瀛楁 - order: this.formSum.order, // 鎺掑簭瀛楁 - page: this.formSum.page, // 绗嚑椤� - rows: this.formSum.rows // 姣忛〉澶氬皯鏉� - } - - const res = await AnDonReportSumSearch(data) - this.tableDataSum = res.data - this.totalSum = res.count - }, - // 鑾峰彇鐢熶骇杞﹂棿 - async getShopSearch() { - const { data: res } = await PrentOrganization() - this.wkshopSelectArr = res - }, - // 鑾峰彇鍛煎彨绫诲瀷 - async getAnDengTypeSearch() { - const { data: res } = await AnDengTypeSearch() - this.calltypeSelectArr = res - }, - async getWhkspIsEqpSearch(val) { - this.formSum.eqpcode = '' - const { data: res } = await WhkspIsEqpSearch({ wkshpcode: val }) - this.devicetypeArr = res - }, - // tab鏍囩鍒囨崲 - tabClick(val) { - this.currentTabPositionName = val.label - - if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { - this.getAnDonReportDefinitSearch() - } else { - this.getAnDonReportSumSearch() - } - - this.$nextTick(() => { - this.$refs['tableDataRef'].doLayout() - this.$refs['tableDataRef2'].doLayout() - }) - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getAnDonReportDefinitSearch() - } else { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.formSum.order = order - this.formSum.prop = prop - this.getAnDonReportSumSearch() - } - }, - // 鏌ヨ - search() { - if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { - this.getAnDonReportDefinitSearch() - } else { - this.getAnDonReportSumSearch() - } - }, - // 閲嶇疆 - reset() { - if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { - this.form.wkshopcode = '' - this.form.calltypecode = '' - this.form.calluser = '' - this.form.calldate = '' - this.form.eqpcode = '' - this.form.eqpname = '' - this.form.responduser = '' - this.form.responddate = '' - this.getAnDonReportDefinitSearch() - } else { - this.formSum.wkshopcode = '' - this.formSum.calltypecode = '' - this.formSum.calldate = '' - this.formSum.eqpcode = '' - this.formSum.responddate = '' - - this.getAnDonReportSumSearch() - } - }, - async download() { - if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { - let calldate = this.form.calldate - if (calldate.length > 0) { - calldate = handleDatetime(calldate[0]) + '~' + handleDatetime(calldate[1]) - } - let responddate = this.form.responddate - if (responddate.length > 0) { - responddate = handleDatetime(responddate[0]) + '~' + handleDatetime(responddate[1]) - } - const data = { - wkshopcode: this.form.wkshopcode, - calltypecode: this.form.calltypecode, - calluser: this.form.calluser, - calldate: calldate, - eqpcode: this.form.eqpcode, - eqpname: this.form.eqpname, - responduser: this.form.responduser, - responddate: responddate - } - const { data: res } = await AnDonReportDefinitExcelSearch(data) - console.log(res) - window.location.href = res - } else { - let calldate = this.formSum.calldate - if (calldate.length > 0) { - calldate = handleDatetime(calldate[0]) + '~' + handleDatetime(calldate[1]) - } - let responddate = this.formSum.responddate - if (responddate.length > 0) { - responddate = handleDatetime(responddate[0]) + '~' + handleDatetime(responddate[1]) - } - const data = { - wkshopcode: this.formSum.wkshopcode, - calltypecode: this.formSum.calltypecode, - calldate: calldate, - eqpcode: this.formSum.eqpcode, - responddate: responddate - } - const { data: res } = await AnDonReportSumExcelSearch(data) - window.location.href = res - } - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 180 - this.$refs.tableDataRef.doLayout() - this.$refs.tableDataRef2.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<!--鍏叡椤甸潰鏍峰紡--> -<style lang="scss" scoped> -$main_color: #42b983; - -::v-deep .el-tabs--border-card > .el-tabs__content { - padding: 0 10px; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} - -.el-icon-share, .el-icon-delete, .el-icon-edit-outline { - color: $main_color; - cursor: pointer; -} - -.el-icon-edit-outline { - margin-right: 15px; -} - -::v-deep .el-button--primary, .el-button--default, .el-button--info { - height: 34px; - display: flex; - align-items: center; - padding: 0 15px; -} - -::v-deep .el-button--primary { - //background-color: $main_color !important; -} - -::v-deep .el-button--default { - background-color: #f8f8fa; - border: none; -} - -::v-deep .el-input__inner { - height: 34px; - line-height: 34px; - //color: #a7a7a7; -} - -::v-deep .el-dialog__body { - padding: 20px 100px !important; -} - -::v-deep .dialogVisibleRoles .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .importPickerClass .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .el-dialog__footer { - display: flex; - justify-content: flex-end; -} - -::v-deep .el-table .caret-wrapper { - transform: scale(0.8); -} - -::v-deep .cell { - display: flex; - align-items: center; - justify-content: space-between; -} - -::v-deep .el-table::before { - height: 0; -} - -::v-deep .el-table__body-wrapper { - background-color: #f8f8fa; -} - -::v-deep .el-table__body .el-table__row.hover-row td { - background-color: #eaecef; -} - -::v-deep .el-form--inline .el-form-item__label { - color: #a7a7a7; -} - -.body ::v-deep .el-divider { - border: 1px solid #eee; - width: 99%; - margin: 10px auto; -} - -.body ::v-deep .el-form-item { - margin-bottom: 0; -} - -.userDialogVisible ::v-deep .el-form-item { - margin-bottom: 0; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -.tableFixed { - ::v-deep .el-table__fixed-right { - height: 100% !important; - } - - ::v-deep .el-table__fixed { - height: 100% !important; - } -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div v-show="currentTabPositionName==='瀹夌伅鏄庣粏'" class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> + <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in wkshopSelectArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="鍛煎彨绫诲瀷" style=" display: flex;"> + <el-select v-model="form.calltypecode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in calltypeSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鍛煎彨浜哄憳" style=" display: flex;"> + <el-input v-model="form.calluser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍛煎彨鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> + <el-date-picker + v-model="form.calldate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="璁惧缂栫爜" style=" display: flex;"> + <el-input v-model="form.eqpcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="璁惧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.eqpname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鍝嶅簲浜哄憳" style=" display: flex;"> + <el-input v-model="form.responduser" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鍝嶅簲鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> + <el-date-picker + v-model="form.responddate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div v-show="currentTabPositionName==='瀹夌伅姹囨��'" class="bodyTopFormGroup"> + <el-form + ref="formSum" + :model="formSum" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;"> + <el-select + v-model="formSum.wkshopcode" + style="width: 200px" + placeholder="璇烽�夋嫨" + @change="getWhkspIsEqpSearch" + > + <el-option + v-for="item in wkshopSelectArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="鐢熶骇璁惧" style=" display: flex;"> + <el-select + v-model="formSum.eqpcode" + :disabled="formSum.wkshopcode===''" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in devicetypeArr" + :key="item.eqp_code" + :label="item.eqp_name" + :value="item.eqp_code" + /> + </el-select> + </el-form-item> + <el-form-item label="鍛煎彨绫诲瀷" style=" display: flex;"> + <el-select v-model="formSum.calltypecode" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in calltypeSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鍛煎彨鏃堕棿" style="display: flex;font-size: 14px;align-items: center"> + <el-date-picker + v-model="formSum.calldate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + <el-form-item + v-show="isExpandForm" + label="鍝嶅簲鏃堕棿" + style="display: flex;font-size: 14px;align-items: center" + > + <el-date-picker + v-model="formSum.responddate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <el-tabs + ref="elTabsRef" + type="border-card" + :style="{height:isExpandForm?tableHeight+'px':(tableHeight+40)+'px'}" + @tab-click="tabClick" + > + <el-tab-pane label="瀹夌伅鏄庣粏"> + <div class="elTableDiv"> + <TableColumnSettings + v-if="false" + :list1="tableColumnSettingsArray" + @tableColumnUpdate="tableColumnUpdate" + /> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + class="tableFixed" + :data="tableData" + border + :height="isExpandForm?(tableHeight-130):(tableHeight-90)+'px'" + :row-class-name="tableRowClassName" + :style="{width: 100+'%' ,height:isExpandForm?(tableHeight-130):(tableHeight-90)+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='status'"> + <div v-if="row.status==='宸插搷搴�'" style="display: flex;align-items: center"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 宸插搷搴� + </div> + <div v-if="row.status==='寰呭搷搴�'" style="display: flex;align-items: center"> + <i class="el-icon-info" style="margin-right: 2px" /> + 寰呭搷搴� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getAnDonReportDefinitSearch" + /> + </el-tab-pane> + <el-tab-pane label="瀹夌伅姹囨��"> + <div class="elTableDiv"> + <TableColumnSettings + v-if="false" + :list1="tableColumnSettingsArray2" + @tableColumnUpdate="tableColumnUpdate2" + /> + <el-table + ref="tableDataRef2" + :key="tableTimeStampKey2" + class="tableFixed" + :data="tableDataSum" + border + :height="isExpandForm?(tableHeight-130):(tableHeight-90)+'px'" + :row-class-name="tableRowClassName" + :style="{width: 100+'%' ,height:isExpandForm?(tableHeight-130):(tableHeight-90)+'px'}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray2" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='repondtime'"> + {{ row.repondtime }} 鍒嗛挓 + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="totalSum" + :page.sync="formSum.page" + :limit.sync="formSum.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getAnDonReportDefinitSearch" + /> + </el-tab-pane> + </el-tabs> + + </div> + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { AnDengTypeSearch, WhkspIsEqpSearch } from '@/api/basicSettings' +import { handleDatetime } from '@/utils/global' +import { + AnDonReportDefinitExcelSearch, + AnDonReportDefinitSearch, + AnDonReportSumExcelSearch, + AnDonReportSumSearch +} from '@/api/ReportManager' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' +import { PrentOrganization } from '@/api/GeneralBasicData' + +export default { + name: 'InstallationLampList', + components: { + Pagination, TableColumnSettings + }, + directives: { waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + wkshopcode: '', // 杞﹂棿缂栫爜 + calltypecode: '', // 鍛煎彨绫诲瀷缂栫爜 + calluser: '', // 鍛煎彨浜哄憳 + calldate: '', // 鍛煎彨鏃堕棿 + eqpcode: '', // 璁惧缂栫爜 + eqpname: '', // 璁惧鍚嶇О + responduser: '', // 鍝嶅簲浜哄憳 + responddate: '', // 鍝嶅簲鏃堕棿 + prop: 'eqp_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + wkshopSelectArr: [], // 鐢熶骇杞﹂棿涓嬫媺鏁扮粍 + calltypeSelectArr: [], // 鍛煎彨绫诲瀷涓嬫媺鏁扮粍 + tableData: [], + tableColumnSettingsArray: [ + // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'wkshp_code', + label: '杞﹂棿缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'wkshp_name', + label: '杞﹂棿鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_code', + label: '璁惧缂栫爜', + id: 5, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'eqp_name', + label: '璁惧鍚嶇О', + id: 6, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'typename', + label: '鍛煎彨绫诲瀷', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'start_user', + label: '鍛煎彨浜�', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 160, + width: false, + prop: 'start_date', + label: '鍛煎彨鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'resp_user', + label: '鍝嶅簲浜�', + id: 10, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 160, + width: false, + prop: 'resp_date', + label: '鍝嶅簲鏃堕棿', + id: 11, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 130, + width: false, + prop: 'respondcont', + label: '鍝嶅簲鏃堕暱', + id: 12, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'status', + label: '鐘舵��', + id: 13, + show: true, + fixed: 'right', + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + currentTabPositionName: '瀹夌伅鏄庣粏', // Tab鏍囩浣嶄簬鐨勪綅缃� 榛樿绗��0鈥欎釜 + formSum: { + wkshopcode: '', // 杞﹂棿缂栫爜 + calltypecode: '', // 鍛煎彨绫诲瀷缂栫爜 + calldate: '', // 鍛煎彨鏃堕棿 + eqpcode: '', // 璁惧缂栫爜 + responddate: '', // 鍝嶅簲鏃堕棿 + prop: 'eqp_code', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + tableDataSum: [], + totalSum: 0, + tableColumnSettingsArray2: [ + // { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: 25, width: 50, prop: 'RowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'wkshp_name', + label: '鐢熶骇杞﹂棿', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_code', + label: '璁惧缂栫爜', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'eqp_name', + label: '璁惧鍚嶇О', + id: 5, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'calltypename', + label: '鍛煎彨绫诲瀷', + id: 6, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'callcount', + label: '鍛煎彨鎬绘鏁�', + id: 7, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'repondcount', + label: '鍝嶅簲鎬绘鏁�', + id: 8, + show: true, + fixed: false, + sortable: true + }, { + minWidth: 110, + width: false, + prop: 'repondtime', + label: '鎬诲搷搴旀椂闀�', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey2: new Date().getTime(), // 琛ㄦ牸key + + devicetypeArr: []// 鐢熶骇璁惧涓嬫媺鏁扮粍 + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + this.$refs.tableDataRef.doLayout() + }, + tableColumnUpdate2(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray2 = val + } + this.tableTimeStampKey2 = new Date().getTime() + this.$refs.tableDataRef2.doLayout() + }, + handleRequest() { + this.getAnDonReportDefinitSearch().then(res => { + if (res.code === '200') { + this.getShopSearch() + this.getAnDengTypeSearch() + } + }) + }, + async getAnDonReportDefinitSearch() { + let tempDate = this.form.calldate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + let tempDate2 = this.form.responddate + if (tempDate2.length > 0) { + tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1]) + } + + const data = { + wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜 + calltypecode: this.form.calltypecode, // 鍛煎彨绫诲瀷缂栫爜 + calluser: this.form.calluser, // 鍛煎彨浜哄憳 + calldate: tempDate, // 鍛煎彨鏃堕棿 + eqpcode: this.form.eqpcode, // 璁惧缂栫爜 + eqpname: this.form.eqpname, // 璁惧鍚嶇О + responduser: this.form.responduser, // 鍝嶅簲浜哄憳 + responddate: tempDate2, // 鍝嶅簲鏃堕棿 + prop: this.form.prop, // 鎺掑簭瀛楁 + order: this.form.order, // 鎺掑簭瀛楁 + page: this.form.page, // 绗嚑椤� + rows: this.form.rows // 姣忛〉澶氬皯鏉� + } + + const res = await AnDonReportDefinitSearch(data) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + async getAnDonReportSumSearch() { + let tempDate = this.formSum.calldate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + let tempDate2 = this.formSum.responddate + if (tempDate2.length > 0) { + tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1]) + } + + const data = { + wkshopcode: this.formSum.wkshopcode, // 杞﹂棿缂栫爜 + calltypecode: this.formSum.calltypecode, // 鍛煎彨绫诲瀷缂栫爜 + calldate: tempDate, // 鍛煎彨鏃堕棿 + eqpcode: this.formSum.eqpcode, // 璁惧缂栫爜 + responddate: tempDate2, // 鍝嶅簲鏃堕棿 + prop: this.formSum.prop, // 鎺掑簭瀛楁 + order: this.formSum.order, // 鎺掑簭瀛楁 + page: this.formSum.page, // 绗嚑椤� + rows: this.formSum.rows // 姣忛〉澶氬皯鏉� + } + + const res = await AnDonReportSumSearch(data) + this.tableDataSum = res.data + this.totalSum = res.count + }, + // 鑾峰彇鐢熶骇杞﹂棿 + async getShopSearch() { + const { data: res } = await PrentOrganization() + this.wkshopSelectArr = res + }, + // 鑾峰彇鍛煎彨绫诲瀷 + async getAnDengTypeSearch() { + const { data: res } = await AnDengTypeSearch() + this.calltypeSelectArr = res + }, + async getWhkspIsEqpSearch(val) { + this.formSum.eqpcode = '' + const { data: res } = await WhkspIsEqpSearch({ wkshpcode: val }) + this.devicetypeArr = res + }, + // tab鏍囩鍒囨崲 + tabClick(val) { + this.currentTabPositionName = val.label + + if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { + this.getAnDonReportDefinitSearch() + } else { + this.getAnDonReportSumSearch() + } + + this.$nextTick(() => { + this.$refs['tableDataRef'].doLayout() + this.$refs['tableDataRef2'].doLayout() + }) + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getAnDonReportDefinitSearch() + } else { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.formSum.order = order + this.formSum.prop = prop + this.getAnDonReportSumSearch() + } + }, + // 鏌ヨ + search() { + if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { + this.getAnDonReportDefinitSearch() + } else { + this.getAnDonReportSumSearch() + } + }, + // 閲嶇疆 + reset() { + if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { + this.form.wkshopcode = '' + this.form.calltypecode = '' + this.form.calluser = '' + this.form.calldate = '' + this.form.eqpcode = '' + this.form.eqpname = '' + this.form.responduser = '' + this.form.responddate = '' + this.getAnDonReportDefinitSearch() + } else { + this.formSum.wkshopcode = '' + this.formSum.calltypecode = '' + this.formSum.calldate = '' + this.formSum.eqpcode = '' + this.formSum.responddate = '' + + this.getAnDonReportSumSearch() + } + }, + async download() { + if (this.currentTabPositionName === '瀹夌伅鏄庣粏') { + let calldate = this.form.calldate + if (calldate.length > 0) { + calldate = handleDatetime(calldate[0]) + '~' + handleDatetime(calldate[1]) + } + let responddate = this.form.responddate + if (responddate.length > 0) { + responddate = handleDatetime(responddate[0]) + '~' + handleDatetime(responddate[1]) + } + const data = { + wkshopcode: this.form.wkshopcode, + calltypecode: this.form.calltypecode, + calluser: this.form.calluser, + calldate: calldate, + eqpcode: this.form.eqpcode, + eqpname: this.form.eqpname, + responduser: this.form.responduser, + responddate: responddate + } + const { data: res } = await AnDonReportDefinitExcelSearch(data) + console.log(res) + window.location.href = res + } else { + let calldate = this.formSum.calldate + if (calldate.length > 0) { + calldate = handleDatetime(calldate[0]) + '~' + handleDatetime(calldate[1]) + } + let responddate = this.formSum.responddate + if (responddate.length > 0) { + responddate = handleDatetime(responddate[0]) + '~' + handleDatetime(responddate[1]) + } + const data = { + wkshopcode: this.formSum.wkshopcode, + calltypecode: this.formSum.calltypecode, + calldate: calldate, + eqpcode: this.formSum.eqpcode, + responddate: responddate + } + const { data: res } = await AnDonReportSumExcelSearch(data) + window.location.href = res + } + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 180 + this.$refs.tableDataRef.doLayout() + this.$refs.tableDataRef2.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<!--鍏叡椤甸潰鏍峰紡--> +<style lang="scss" scoped> +$main_color: #42b983; + +::v-deep .el-tabs--border-card > .el-tabs__content { + padding: 0 10px; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} + +.el-icon-share, .el-icon-delete, .el-icon-edit-outline { + color: $main_color; + cursor: pointer; +} + +.el-icon-edit-outline { + margin-right: 15px; +} + +::v-deep .el-button--primary, .el-button--default, .el-button--info { + height: 34px; + display: flex; + align-items: center; + padding: 0 15px; +} + +::v-deep .el-button--primary { + //background-color: $main_color !important; +} + +::v-deep .el-button--default { + background-color: #f8f8fa; + border: none; +} + +::v-deep .el-input__inner { + height: 34px; + line-height: 34px; + //color: #a7a7a7; +} + +::v-deep .el-dialog__body { + padding: 20px 100px !important; +} + +::v-deep .dialogVisibleRoles .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .importPickerClass .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .el-dialog__footer { + display: flex; + justify-content: flex-end; +} + +::v-deep .el-table .caret-wrapper { + transform: scale(0.8); +} + +::v-deep .cell { + display: flex; + align-items: center; + justify-content: space-between; +} + +::v-deep .el-table::before { + height: 0; +} + +::v-deep .el-table__body-wrapper { + background-color: #f8f8fa; +} + +::v-deep .el-table__body .el-table__row.hover-row td { + background-color: #eaecef; +} + +::v-deep .el-form--inline .el-form-item__label { + color: #a7a7a7; +} + +.body ::v-deep .el-divider { + border: 1px solid #eee; + width: 99%; + margin: 10px auto; +} + +.body ::v-deep .el-form-item { + margin-bottom: 0; +} + +.userDialogVisible ::v-deep .el-form-item { + margin-bottom: 0; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +.tableFixed { + ::v-deep .el-table__fixed-right { + height: 100% !important; + } + + ::v-deep .el-table__fixed { + height: 100% !important; + } +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/personSalaryList.vue b/src/views/statistic/personSalaryList.vue index fb17ab7..6b75bed 100644 --- a/src/views/statistic/personSalaryList.vue +++ b/src/views/statistic/personSalaryList.vue @@ -1,901 +1,906 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - - <div - style="color: red;margin: 10px 5px 0 0;" - >褰撳墠鎶ヨ〃鍙粺璁¤嚜鍒朵欢宸ュ簭 - </div> - - <!-- <div class="topRight" style="display: flex;align-items: center">--> - <!-- <!– <div style="font-size: 14px;margin-right: 15px;color: #a7a7a7">鍓旈櫎宸ュ簭</div>–>--> - <!-- <el-select--> - <!-- v-model="form.rejectstepcode"--> - <!-- style="width: 170px;"--> - <!-- multiple--> - <!-- placeholder="璇烽�夋嫨鍓旈櫎宸ュ簭"--> - <!-- collapse-tags--> - <!-- filterable--> - <!-- clearable--> - <!-- @change="getPeopleSalaryReportSearch"--> - <!-- >--> - <!-- <el-option--> - <!-- v-for="item in StepSelectArr"--> - <!-- :key="item.stepcode"--> - <!-- :label="item.stepname"--> - <!-- :value="item.stepcode"--> - <!-- />--> - <!-- </el-select>--> - <!-- </div>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex; " - > - <div class="elForm"> - <el-form-item label="閿�鍞崟鍙�" style="display: flex;"> - <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style="display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <!-- <el-form-item v-show="isExpandForm" label="鐢熶骇鐝粍" style=" display: flex;">--> - <!-- <el-select v-model="form.groupcode" style="width: 200px" placeholder="璇烽�夋嫨">--> - <!-- <el-option--> - <!-- v-for="item in groupArr"--> - <!-- :key="item.group_code"--> - <!-- :label="item.group_name"--> - <!-- :value="item.group_code"--> - <!-- />--> - <!-- </el-select>--> - <!-- </el-form-item>--> - <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> - <el-input v-model="form.reportname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.reportdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <el-tabs type="border-card" style="margin-top: 10px" @tab-click="tabClick"> - <el-tab-pane label="鏈亾宸ュ簭"> - <div class="elTableDiv" style="margin: 0 auto 10px;"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?(tableHeight-120):(tableHeight-40)+'px'" - border - :summary-method="getSummaries" - show-summary - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?(tableHeight-80):(tableHeight-40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <el-table-column - prop="saleOrderCode" - label="閿�鍞崟鍙�" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - - <el-table-column - prop="step_code" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="group_name"--> - <!-- label="鐢熶骇鐝粍"--> - <!-- width="110"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.group_name">{{ row.group_name }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <el-table-column - prop="report_qty" - label="鎶ュ伐鏁伴噺" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.report_qty">{{ row.report_qty }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="step_price" - label="宸ュ簭鍗曚环" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.step_price">{{ row.step_price }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="ratio"--> - <!-- label="鍒嗛厤姣斾緥"--> - <!-- width="110"--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.step_price">{{ row.ratio }} %</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <el-table-column - prop="moneys" - label="涓汉璁′欢宸ヨ祫" - width="130" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.moneys">{{ row.moneys }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="username" - label="鎶ュ伐浜哄憳" - width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎶ュ伐鏃堕棿" - width="160" - sortable="custom" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getPeopleSalaryReportSearch" - /> - </el-tab-pane> - <el-tab-pane label="閫愰亾宸ュ簭"> - <div class="elTableDiv" style="margin: 0 auto 10px;"> - <el-table - ref="tableDataRef2" - class="tableFixed" - :data="tableData2" - :height="isExpandForm?(tableHeight-80):(tableHeight-40)+'px'" - border - :summary-method="getSummaries" - show-summary - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?(tableHeight-80):(tableHeight-40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <el-table-column - prop="saleOrderCode" - label="閿�鍞崟鍙�" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="160" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - - <el-table-column - prop="step_code" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="task_qty" - label="浠诲姟鏁伴噺" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="group_name"--> - <!-- label="鐢熶骇鐝粍"--> - <!-- width="110"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div v-if="row.group_name">{{ row.group_name }}</div>--> - <!-- <div v-else>/</div>--> - <!-- </template>--> - <!-- </el-table-column>--> - <el-table-column - prop="report_qty" - label="鎶ュ伐鏁伴噺" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.report_qty">{{ row.report_qty }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="step_price" - label="宸ュ簭鍗曚环" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.step_price">{{ row.step_price }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="moneys" - label="涓汉璁′欢宸ヨ祫" - width="130" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.moneys">{{ row.moneys }} 鍏�</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="username" - label="鎶ュ伐浜哄憳" - width="110" - sortable="custom" - /> - <el-table-column - prop="report_date" - label="鎶ュ伐鏃堕棿" - width="160" - sortable="custom" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getPeopleSalaryReportSearch" - /> - </el-tab-pane> - </el-tabs> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> - <el-tag - v-for="tag in tagArr" - :key="tag.name" - type="success" - style="margin-right: 15px;min-width: 80px;text-align: center" - > - {{ tag }} - </el-tag> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { handleDatetime, validateCode } from '@/utils/global' -import { - GroupSalaryReportSearchUser, PeopleSalaryReportExcelSearch, PeopleSalaryReportSearch -} from '@/api/ReportManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'PersonSalaryList', - components: { - Pagination, ImportPicker - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - StepSelectArr: [], // 鍓旈櫎宸ュ簭鏁扮粍 - form: { - socode: '', - wkshopcode: '', - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - stepname: '', // 宸ュ簭鍚嶇О - groupcode: '', // 鐢熶骇鐝粍 - reportname: '', // 鎿嶄綔浜哄憳 - reportdate: '', // 鎿嶄綔鏃堕棿 - rejectstepcode: [], // 鍓旈櫎宸ュ簭(鍥哄畾钖祫宸ュ簭涓嶅弬涓庤绠� - compute: 'last', // 璁′欢鏂瑰紡 - prop: 'partcode', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - wkshopcodeArr: [], - groupArr: [], - total: 10, - tableData: [], - tableData2: [], - dialogVisible: false, - tagArr: [], // - dialogForm: { - OrgType: '', - OrgCode: '', - OrgName: '', - SupUnit: ''// 涓婄骇鍗曚綅 - }, - operation: '', - dialogFormRules: { - OrgType: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - OrgCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrgName: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getPeopleSalaryReportSearch() - } - } - }, - // updated() { - // this.$nextTick(() => { - // this.$refs.tableDataRef.doLayout() - // this.$refs.tableDataRef2.doLayout() - // }) - // }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - handleRequest() { - this.getPeopleSalaryReportSearch().then(res => { - if (res.code === '200') { - this.getPrentOrganizationNoCompany() - - // this.getMesOrderStepReportSelectUserGroup() - // this.getStepSelect() - } - }) - }, - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - // 鑾峰彇宸ュ簭涓嬫媺鎺ュ彛 - // async getStepSelect() { - // const { data: res } = await StepSelect() - // this.StepSelectArr = res - // }, - getSummaries(param) { - const { columns, data } = param - const sums = [] - - const i = this.form.compute === 'last' ? 11 : 11 - - columns.forEach((column, index) => { - if (index === i) { - sums[index] = '鎬讳环' - return - } - const values = data.map(item => Number(item[column.property])) - if (column.property === 'moneys') { - sums[index] = values.reduce((prev, curr) => { - const value = Number(curr) - if (!isNaN(value)) { - // return prev + curr - return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 - } else { - return Math.round(prev * 100) / 100 - } - }, 0) - - sums[index] = sums[index].toFixed(2) + ' 鍏�' - } else { - // sums[index] = 'N/A' - sums[index] = ' ' - } - }) - - this.$nextTick(() => { - this.$refs.tableDataRef.doLayout() - this.$refs.tableDataRef2.doLayout() - }) - // (Math.round(sums * 100) / 100).toS - - // console.log(typeof sums) - // console.log(sums[11].split(' ')) - return sums - }, - async getPeopleSalaryReportSearch() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - socode: this.form.socode, - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - groupcode: this.form.groupcode, - compute: this.form.compute, - reportname: this.form.reportname, - rejectstepcode: this.form.rejectstepcode.join(','), - reportdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - - const res = await PeopleSalaryReportSearch(data) - if (this.form.compute === 'last') { - this.tableData = res.data - } - if (this.form.compute === 'contin') { - this.tableData2 = res.data - } - this.total = res.count - - return { code: res.code } - }, - - // async getMesOrderStepReportSelectUserGroup() { - // const { data: res } = await MesOrderStepReportSelectUserGroup() - // this.groupArr = res - // }, - tabClick(val) { - this.form.compute = val.label === '鏈亾宸ュ簭' ? 'last' : 'contin' - this.getPeopleSalaryReportSearch() - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getPeopleSalaryReportSearch() - }, - async download() { - let tempDate = this.form.reportdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - socode: this.form.socode, - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - groupcode: this.form.groupcode, - compute: this.form.compute, - reportname: this.form.reportname, - reportdate: tempDate - } - - const { data: res } = await PeopleSalaryReportExcelSearch(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getPeopleSalaryReportSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.socode = '' - this.form.wkshopcode = '' - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.groupcode = '' - this.form.reportname = '' - this.form.reportdate = '' - this.getPeopleSalaryReportSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await GroupSalaryReportSearchUser({ id: row.id }) - this.tagArr = res.data.map(r => r.reportname) - // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - // confirmButtonText: '纭畾', - // cancelButtonText: '鍙栨秷', - // type: 'warning' - // }).then(() => { - // DeleteOrganization({ orgid: row.code }).then(res => { - // if (res.code === '200') { - // this.$message.success('鍒犻櫎鎴愬姛!') - // if (this.form.page > 1 && this.tableData.length === 1) { - // this.form.page-- - // } - // this.getPeopleSalaryReportSearch() - // } - // }) - // }).catch(() => { - // this.$message.info('宸插彇娑堝垹闄�') - // }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrgType = '' - this.dialogForm.OrgCode = '' - this.dialogForm.OrgName = '' - this.dialogForm.SupUnit = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - // AddUpdateOrganization(data).then(res => { - // if (res.code === '200') { - // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - // this.dialogVisible = false - // this.getPeopleSalaryReportSearch() - // } else { - // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - // } - // }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 245 - this.$refs.tableDataRef.doLayout() - this.$refs.tableDataRef2.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} -</style> -<style> -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + + <div + style="color: red;margin: 10px 5px 0 0;" + >褰撳墠鎶ヨ〃鍙粺璁¤嚜鍒朵欢宸ュ簭 + </div> + + <!-- <div class="topRight" style="display: flex;align-items: center">--> + <!-- <!– <div style="font-size: 14px;margin-right: 15px;color: #a7a7a7">鍓旈櫎宸ュ簭</div>–>--> + <!-- <el-select--> + <!-- v-model="form.rejectstepcode"--> + <!-- style="width: 170px;"--> + <!-- multiple--> + <!-- placeholder="璇烽�夋嫨鍓旈櫎宸ュ簭"--> + <!-- collapse-tags--> + <!-- filterable--> + <!-- clearable--> + <!-- @change="getPeopleSalaryReportSearch"--> + <!-- >--> + <!-- <el-option--> + <!-- v-for="item in StepSelectArr"--> + <!-- :key="item.stepcode"--> + <!-- :label="item.stepname"--> + <!-- :value="item.stepcode"--> + <!-- />--> + <!-- </el-select>--> + <!-- </div>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex; " + > + <div class="elForm"> + <el-form-item label="閿�鍞崟鍙�" style="display: flex;"> + <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style="display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <!-- <el-form-item v-show="isExpandForm" label="鐢熶骇鐝粍" style=" display: flex;">--> + <!-- <el-select v-model="form.groupcode" style="width: 200px" placeholder="璇烽�夋嫨">--> + <!-- <el-option--> + <!-- v-for="item in groupArr"--> + <!-- :key="item.group_code"--> + <!-- :label="item.group_name"--> + <!-- :value="item.group_code"--> + <!-- />--> + <!-- </el-select>--> + <!-- </el-form-item>--> + <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> + <el-input v-model="form.reportname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.reportdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <el-tabs type="border-card" style="margin-top: 10px" @tab-click="tabClick"> + <el-tab-pane label="鏈亾宸ュ簭"> + <div class="elTableDiv" style="margin: 0 auto 10px;"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?(tableHeight-120):(tableHeight-40)+'px'" + border + :summary-method="getSummaries" + show-summary + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?(tableHeight-80):(tableHeight-40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <el-table-column + prop="saleOrderCode" + label="閿�鍞崟鍙�" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + + <el-table-column + prop="step_code" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="group_name"--> + <!-- label="鐢熶骇鐝粍"--> + <!-- width="110"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.group_name">{{ row.group_name }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <el-table-column + prop="report_qty" + label="鎶ュ伐鏁伴噺" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.report_qty">{{ row.report_qty }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="step_price" + label="宸ュ簭鍗曚环" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.step_price">{{ row.step_price }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="ratio"--> + <!-- label="鍒嗛厤姣斾緥"--> + <!-- width="110"--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.step_price">{{ row.ratio }} %</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <el-table-column + prop="moneys" + label="涓汉璁′欢宸ヨ祫" + width="130" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.moneys">{{ row.moneys }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="username" + label="鎶ュ伐浜哄憳" + width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎶ュ伐鏃堕棿" + width="160" + sortable="custom" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getPeopleSalaryReportSearch" + /> + </el-tab-pane> + <el-tab-pane label="閫愰亾宸ュ簭"> + <div class="elTableDiv" style="margin: 0 auto 10px;"> + <el-table + ref="tableDataRef2" + class="tableFixed" + :data="tableData2" + :height="isExpandForm?(tableHeight-80):(tableHeight-40)+'px'" + border + :summary-method="getSummaries" + show-summary + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?(tableHeight-80):(tableHeight-40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <el-table-column + prop="saleOrderCode" + label="閿�鍞崟鍙�" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="160" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + + <el-table-column + prop="step_code" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="task_qty" + label="浠诲姟鏁伴噺" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="group_name"--> + <!-- label="鐢熶骇鐝粍"--> + <!-- width="110"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div v-if="row.group_name">{{ row.group_name }}</div>--> + <!-- <div v-else>/</div>--> + <!-- </template>--> + <!-- </el-table-column>--> + <el-table-column + prop="report_qty" + label="鎶ュ伐鏁伴噺" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.report_qty">{{ row.report_qty }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="step_price" + label="宸ュ簭鍗曚环" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.step_price">{{ row.step_price }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="moneys" + label="涓汉璁′欢宸ヨ祫" + width="130" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.moneys">{{ row.moneys }} 鍏�</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="username" + label="鎶ュ伐浜哄憳" + width="110" + sortable="custom" + /> + <el-table-column + prop="report_date" + label="鎶ュ伐鏃堕棿" + width="160" + sortable="custom" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getPeopleSalaryReportSearch" + /> + </el-tab-pane> + </el-tabs> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> + <el-tag + v-for="tag in tagArr" + :key="tag.name" + type="success" + style="margin-right: 15px;min-width: 80px;text-align: center" + > + {{ tag }} + </el-tag> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { handleDatetime, validateCode } from '@/utils/global' +import { + GroupSalaryReportSearchUser, PeopleSalaryReportExcelSearch, PeopleSalaryReportSearch +} from '@/api/ReportManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'PersonSalaryList', + components: { + Pagination, ImportPicker + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + StepSelectArr: [], // 鍓旈櫎宸ュ簭鏁扮粍 + form: { + socode: '', + wkshopcode: '', + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + stepname: '', // 宸ュ簭鍚嶇О + groupcode: '', // 鐢熶骇鐝粍 + reportname: '', // 鎿嶄綔浜哄憳 + reportdate: '', // 鎿嶄綔鏃堕棿 + rejectstepcode: [], // 鍓旈櫎宸ュ簭(鍥哄畾钖祫宸ュ簭涓嶅弬涓庤绠� + compute: 'last', // 璁′欢鏂瑰紡 + prop: 'partcode', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + wkshopcodeArr: [], + groupArr: [], + total: 10, + tableData: [], + tableData2: [], + dialogVisible: false, + tagArr: [], // + dialogForm: { + OrgType: '', + OrgCode: '', + OrgName: '', + SupUnit: ''// 涓婄骇鍗曚綅 + }, + operation: '', + dialogFormRules: { + OrgType: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + OrgCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrgName: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getPeopleSalaryReportSearch() + } + } + }, + // updated() { + // this.$nextTick(() => { + // this.$refs.tableDataRef.doLayout() + // this.$refs.tableDataRef2.doLayout() + // }) + // }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + handleRequest() { + this.getPeopleSalaryReportSearch().then(res => { + if (res.code === '200') { + this.getPrentOrganizationNoCompany() + + // this.getMesOrderStepReportSelectUserGroup() + // this.getStepSelect() + } + }) + }, + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + // 鑾峰彇宸ュ簭涓嬫媺鎺ュ彛 + // async getStepSelect() { + // const { data: res } = await StepSelect() + // this.StepSelectArr = res + // }, + getSummaries(param) { + const { columns, data } = param + const sums = [] + + const i = this.form.compute === 'last' ? 11 : 11 + + columns.forEach((column, index) => { + if (index === i) { + sums[index] = '鎬讳环' + return + } + const values = data.map(item => Number(item[column.property])) + if (column.property === 'moneys') { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + // return prev + curr + return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100 + } else { + return Math.round(prev * 100) / 100 + } + }, 0) + + sums[index] = sums[index].toFixed(2) + ' 鍏�' + } else { + // sums[index] = 'N/A' + sums[index] = ' ' + } + }) + + this.$nextTick(() => { + this.$refs.tableDataRef.doLayout() + this.$refs.tableDataRef2.doLayout() + }) + // (Math.round(sums * 100) / 100).toS + + // console.log(typeof sums) + // console.log(sums[11].split(' ')) + return sums + }, + async getPeopleSalaryReportSearch() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + socode: this.form.socode, + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + groupcode: this.form.groupcode, + compute: this.form.compute, + reportname: this.form.reportname, + rejectstepcode: this.form.rejectstepcode.join(','), + reportdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + + const res = await PeopleSalaryReportSearch(data) + if (this.form.compute === 'last') { + this.tableData = res.data + } + if (this.form.compute === 'contin') { + this.tableData2 = res.data + } + this.total = res.count + + return { code: res.code } + }, + + // async getMesOrderStepReportSelectUserGroup() { + // const { data: res } = await MesOrderStepReportSelectUserGroup() + // this.groupArr = res + // }, + tabClick(val) { + this.form.compute = val.label === '鏈亾宸ュ簭' ? 'last' : 'contin' + this.getPeopleSalaryReportSearch() + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getPeopleSalaryReportSearch() + }, + async download() { + let tempDate = this.form.reportdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + socode: this.form.socode, + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + groupcode: this.form.groupcode, + compute: this.form.compute, + reportname: this.form.reportname, + reportdate: tempDate + } + + const { data: res } = await PeopleSalaryReportExcelSearch(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getPeopleSalaryReportSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.socode = '' + this.form.wkshopcode = '' + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.groupcode = '' + this.form.reportname = '' + this.form.reportdate = '' + this.getPeopleSalaryReportSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await GroupSalaryReportSearchUser({ id: row.id }) + this.tagArr = res.data.map(r => r.reportname) + // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + // confirmButtonText: '纭畾', + // cancelButtonText: '鍙栨秷', + // type: 'warning' + // }).then(() => { + // DeleteOrganization({ orgid: row.code }).then(res => { + // if (res.code === '200') { + // this.$message.success('鍒犻櫎鎴愬姛!') + // if (this.form.page > 1 && this.tableData.length === 1) { + // this.form.page-- + // } + // this.getPeopleSalaryReportSearch() + // } + // }) + // }).catch(() => { + // this.$message.info('宸插彇娑堝垹闄�') + // }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrgType = '' + this.dialogForm.OrgCode = '' + this.dialogForm.OrgName = '' + this.dialogForm.SupUnit = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + // AddUpdateOrganization(data).then(res => { + // if (res.code === '200') { + // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + // this.dialogVisible = false + // this.getPeopleSalaryReportSearch() + // } else { + // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + // } + // }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 245 + this.$refs.tableDataRef.doLayout() + this.$refs.tableDataRef2.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} +</style> +<style> +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/repairDetailList.vue b/src/views/statistic/repairDetailList.vue index ad6103b..7cdad50 100644 --- a/src/views/statistic/repairDetailList.vue +++ b/src/views/statistic/repairDetailList.vue @@ -1,626 +1,631 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> - <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎿嶄綔绫诲瀷" style=" display: flex;"> - <!-- <el-input v-model="form.style" style="width: 200px" placeholder="璇疯緭鍏�" />--> - <el-select v-model="form.style" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in styleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item v-show="isExpandForm" label="缂洪櫡鍚嶇О" style=" display: flex;"> - <el-input v-model="form.defectname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> - <el-input v-model="form.repairname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.repairdate" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="socode"--> - <!-- label="閿�鍞崟鍙�"--> - <!-- width="160"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="120" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="style" - label="鎿嶄綔绫诲瀷" - width="110" - sortable="custom" - /> - <el-table-column - prop="plan_qty" - label="浠诲姟鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="repair_qty" - label="缁翠慨鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="laborbad_qty" - label="宸ュ簾鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="materielbad_qty" - label="鏂欏簾鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="defect_code" - label="缂洪櫡浠g爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="defect_name" - label="缂洪櫡鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="lm_user" - label="鎿嶄綔浜哄憳" - width="110" - sortable="custom" - /> - <el-table-column - prop="lm_date" - label="鎿嶄綔鏃堕棿" - width="160" - sortable="custom" - /> - - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getMaintenanceDetailsReportSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> - <el-tag - v-for="tag in tagArr" - :key="tag.name" - type="success" - style="margin-right: 15px;min-width: 80px;text-align: center" - > - {{ tag }} - </el-tag> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> - <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> - <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { handleDatetime, validateCode } from '@/utils/global' -import { - GroupSalaryReportSearchUser, MaintenanceDetailsReportExcelSearch, MaintenanceDetailsReportSearch -} from '@/api/ReportManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'RepairDetailList', - components: { - Pagination, ImportPicker - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - - wkshopcode: '', - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - stepname: '', // 宸ュ簭鍚嶇О - style: '', // 鎿嶄綔绫诲瀷 - defectname: '', // 缂洪櫡鍚嶇О - repairname: '', // 鎿嶄綔浜哄憳 - repairdate: '', // 鎿嶄綔鏃堕棿 - prop: 'partcode', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - styleArr: [ - { code: 'B', name: '鎶ュ伐' }, - { code: 'S', name: '鏀舵枡' } - ], - // groupArr: [], - wkshopcodeArr: [], - total: 10, - tableData: [], - dialogVisible: false, - tagArr: [], // - dialogForm: { - OrgType: '', - OrgCode: '', - OrgName: '', - SupUnit: ''// 涓婄骇鍗曚綅 - }, - operation: '', - dialogFormRules: { - OrgType: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - OrgCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrgName: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getMaintenanceDetailsReportSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - handleRequest() { - this.getMaintenanceDetailsReportSearch().then(res => { - if (res.code === '200') { - this.getPrentOrganizationNoCompany() - } - }) - }, - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - async getMaintenanceDetailsReportSearch() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - style: this.form.style, - defectname: this.form.defectname, - repairname: this.form.repairname, - repairdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - - const res = await MaintenanceDetailsReportSearch(data) - this.tableData = res.data - this.total = res.count - - return { code: res.code } - }, - - // async getMesOrderStepReportSelectUserGroup() { - // const { data: res } = await MesOrderStepReportSelectUserGroup() - // this.groupArr = res - // }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getMaintenanceDetailsReportSearch() - }, - async download() { - let tempDate = this.form.repairdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - style: this.form.style, - defectname: this.form.defectname, - repairname: this.form.repairname, - repairdate: tempDate - } - - const { data: res } = await MaintenanceDetailsReportExcelSearch(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getMaintenanceDetailsReportSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.style = '' - this.form.defectname = '' - this.form.repairname = '' - this.form.repairdate = '' - this.getMaintenanceDetailsReportSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - async edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - const res = await GroupSalaryReportSearchUser({ id: row.id }) - this.tagArr = res.data.map(r => r.repairname) - // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] - // this.$nextTick(() => { - // this.dialogForm.OrgCode = row.org_code - // this.dialogForm.OrgName = row.org_name - // this.dialogForm.SupUnit = row.parent_id - // }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - // confirmButtonText: '纭畾', - // cancelButtonText: '鍙栨秷', - // type: 'warning' - // }).then(() => { - // DeleteOrganization({ orgid: row.code }).then(res => { - // if (res.code === '200') { - // this.$message.success('鍒犻櫎鎴愬姛!') - // if (this.form.page > 1 && this.tableData.length === 1) { - // this.form.page-- - // } - // this.getMaintenanceDetailsReportSearch() - // } - // }) - // }).catch(() => { - // this.$message.info('宸插彇娑堝垹闄�') - // }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrgType = '' - this.dialogForm.OrgCode = '' - this.dialogForm.OrgName = '' - this.dialogForm.SupUnit = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - // AddUpdateOrganization(data).then(res => { - // if (res.code === '200') { - // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - // this.dialogVisible = false - // this.getMaintenanceDetailsReportSearch() - // } else { - // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - // } - // }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 295 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText{ - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> + <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎿嶄綔绫诲瀷" style=" display: flex;"> + <!-- <el-input v-model="form.style" style="width: 200px" placeholder="璇疯緭鍏�" />--> + <el-select v-model="form.style" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in styleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item v-show="isExpandForm" label="缂洪櫡鍚嶇О" style=" display: flex;"> + <el-input v-model="form.defectname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐浜哄憳" style=" display: flex;"> + <el-input v-model="form.repairname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鎶ュ伐鏃堕棿" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.repairdate" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+80)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="socode"--> + <!-- label="閿�鍞崟鍙�"--> + <!-- width="160"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="120" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="style" + label="鎿嶄綔绫诲瀷" + width="110" + sortable="custom" + /> + <el-table-column + prop="plan_qty" + label="浠诲姟鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="repair_qty" + label="缁翠慨鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="laborbad_qty" + label="宸ュ簾鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="materielbad_qty" + label="鏂欏簾鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="defect_code" + label="缂洪櫡浠g爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="defect_name" + label="缂洪櫡鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="lm_user" + label="鎿嶄綔浜哄憳" + width="110" + sortable="custom" + /> + <el-table-column + prop="lm_date" + label="鎿嶄綔鏃堕棿" + width="160" + sortable="custom" + /> + + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getMaintenanceDetailsReportSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'浜哄憳鏄庣粏'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px"> + <el-tag + v-for="tag in tagArr" + :key="tag.name" + type="success" + style="margin-right: 15px;min-width: 80px;text-align: center" + > + {{ tag }} + </el-tag> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisible=false">杩� 鍥�</el-button> + <!-- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>--> + <!-- <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>--> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { handleDatetime, validateCode } from '@/utils/global' +import { + GroupSalaryReportSearchUser, MaintenanceDetailsReportExcelSearch, MaintenanceDetailsReportSearch +} from '@/api/ReportManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'RepairDetailList', + components: { + Pagination, ImportPicker + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + + wkshopcode: '', + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + stepname: '', // 宸ュ簭鍚嶇О + style: '', // 鎿嶄綔绫诲瀷 + defectname: '', // 缂洪櫡鍚嶇О + repairname: '', // 鎿嶄綔浜哄憳 + repairdate: '', // 鎿嶄綔鏃堕棿 + prop: 'partcode', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + styleArr: [ + { code: 'B', name: '鎶ュ伐' }, + { code: 'S', name: '鏀舵枡' } + ], + // groupArr: [], + wkshopcodeArr: [], + total: 10, + tableData: [], + dialogVisible: false, + tagArr: [], // + dialogForm: { + OrgType: '', + OrgCode: '', + OrgName: '', + SupUnit: ''// 涓婄骇鍗曚綅 + }, + operation: '', + dialogFormRules: { + OrgType: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + OrgCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrgName: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getMaintenanceDetailsReportSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + handleRequest() { + this.getMaintenanceDetailsReportSearch().then(res => { + if (res.code === '200') { + this.getPrentOrganizationNoCompany() + } + }) + }, + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + async getMaintenanceDetailsReportSearch() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + style: this.form.style, + defectname: this.form.defectname, + repairname: this.form.repairname, + repairdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + + const res = await MaintenanceDetailsReportSearch(data) + this.tableData = res.data + this.total = res.count + + return { code: res.code } + }, + + // async getMesOrderStepReportSelectUserGroup() { + // const { data: res } = await MesOrderStepReportSelectUserGroup() + // this.groupArr = res + // }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getMaintenanceDetailsReportSearch() + }, + async download() { + let tempDate = this.form.repairdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + style: this.form.style, + defectname: this.form.defectname, + repairname: this.form.repairname, + repairdate: tempDate + } + + const { data: res } = await MaintenanceDetailsReportExcelSearch(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getMaintenanceDetailsReportSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.style = '' + this.form.defectname = '' + this.form.repairname = '' + this.form.repairdate = '' + this.getMaintenanceDetailsReportSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + async edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + const res = await GroupSalaryReportSearchUser({ id: row.id }) + this.tagArr = res.data.map(r => r.repairname) + // this.tagArr = ['妤兼潕淇�', '寮犱笁', '鏉庡洓'] + // this.$nextTick(() => { + // this.dialogForm.OrgCode = row.org_code + // this.dialogForm.OrgName = row.org_name + // this.dialogForm.SupUnit = row.parent_id + // }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + // confirmButtonText: '纭畾', + // cancelButtonText: '鍙栨秷', + // type: 'warning' + // }).then(() => { + // DeleteOrganization({ orgid: row.code }).then(res => { + // if (res.code === '200') { + // this.$message.success('鍒犻櫎鎴愬姛!') + // if (this.form.page > 1 && this.tableData.length === 1) { + // this.form.page-- + // } + // this.getMaintenanceDetailsReportSearch() + // } + // }) + // }).catch(() => { + // this.$message.info('宸插彇娑堝垹闄�') + // }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrgType = '' + this.dialogForm.OrgCode = '' + this.dialogForm.OrgName = '' + this.dialogForm.SupUnit = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + // AddUpdateOrganization(data).then(res => { + // if (res.code === '200') { + // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + // this.dialogVisible = false + // this.getMaintenanceDetailsReportSearch() + // } else { + // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + // } + // }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 295 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText{ + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/subcontractingOperation.vue b/src/views/statistic/subcontractingOperation.vue index d77d194..1be6d57 100644 --- a/src/views/statistic/subcontractingOperation.vue +++ b/src/views/statistic/subcontractingOperation.vue @@ -1,656 +1,662 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> - <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <!-- <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">--> - <!-- <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />--> - <!-- </el-form-item>--> - <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> - <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="渚涙柟鍚嶇О" style=" display: flex;"> - <el-input v-model="form.suppername" style="width: 200px" placeholder="璇疯緭鍏�" /> - </el-form-item> - <!-- <el-form-item v-show="isExpandForm" label="鎿嶄綔绫诲瀷" style=" display: flex;">--> - <!-- <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨">--> - <!-- <el-option--> - <!-- v-for="item in typeArr"--> - <!-- :key="item.code"--> - <!-- :label="item.name"--> - <!-- :value="item.code"--> - <!-- />--> - <!-- </el-select>--> - <!-- </el-form-item>--> - <el-form-item - v-show="isExpandForm" - style="display: flex;align-items: center" - :label="form.type==='F'?'鍙戞枡鏃堕棿':'鏀舵枡鏃堕棿'" - > - <el-date-picker - v-model="form.receivdate" - type="daterange" - :disabled="form.type===''" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - <!-- font-size: 14px!important;--> - <!-- :picker-options="expireTimeOption"--> - - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="160" - sortable="custom" - /> - <!-- <el-table-column--> - <!-- prop="saleOrderCode"--> - <!-- label="閿�鍞崟鍙�"--> - <!-- width="160"--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="160" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partspec" - label="浜у搧瑙勬牸" - width="110" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partspec">{{ row.partspec }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepcode" - label="宸ュ簭缂栫爜" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="stepname" - label="宸ュ簭鍚嶇О" - width="110" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="code" - label="澶栧崗渚涙柟缂栫爜" - width="129" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="name" - label="澶栧崗渚涙柟鍚嶇О" - width="240" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="style" - label="鎿嶄綔绫诲瀷" - width="110" - sortable="custom" - /> - <el-table-column - prop="fqty" - label="鍙戞枡鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="sqty" - label="鏀舵枡鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="ng_qty" - label="涓嶈壇鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="laborbad_qty" - label="宸ュ簾鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="materielbad_qty" - label="鏂欏簾鏁伴噺" - width="110" - sortable="custom" - /> - <el-table-column - prop="out_person" - label="鍙戞枡浜�" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.out_person">{{ row.out_person }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="out_time" - label="鍙戞枡鏃堕棿" - width="160" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.out_time">{{ row.out_time }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="in_person" - label="鏀舵枡浜�" - width="110" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.in_person">{{ row.in_person }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="in_time" - label="鏀舵枡鏃堕棿" - width="160" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.in_time">{{ row.in_time }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- label="鎿嶄綔"--> - <!-- width="120"--> - <!-- fixed="right"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div class="operationClass">--> - <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> - <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> - <!-- </el-tooltip>--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i class="el-icon-delete" @click="del(row)" />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getOutSourceReportSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="缁勭粐缂栫爜" prop="OrgCode"> - <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="缁勭粐鍚嶇О" prop="OrgName"> - <el-input v-model="dialogForm.OrgName" style="width: 200px" /> - </el-form-item> - - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!--瀵煎叆缁勪欢--> - <import-picker - ref="importPickerFunc" - class="importPickerClass" - :shows.sync="shows" - :title="title_value" - :colos="colos" - :code="code" - /> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import ImportPicker from '@/components/ImportPicker' -import { handleDatetime, validateCode } from '@/utils/global' -import { OutSourceReportExcelSearch, OutSourceReportSearch } from '@/api/ReportManager' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'SubcontractingOperation', - components: { - Pagination, ImportPicker - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - - wkshopcode: '', - wocode: '', // 宸ュ崟缂栧彿 - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - stepname: '', // 宸ュ簭鍚嶇О - suppername: '', // 渚涙柟鍚嶇О - type: '', // 鎿嶄綔绫诲瀷 - receivdate: '', // 鏀舵枡鏃堕棿 - prop: 'out_time', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - typeArr: [ - { code: 'F', name: '鍙戞枡' }, - { code: 'S', name: '鏀舵枡' } - ], - wkshopcodeArr: [], - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - OrgType: '', - OrgCode: '', - OrgName: '', - SupUnit: ''// 涓婄骇鍗曚綅 - }, - operation: '', - dialogFormRules: { - OrgType: [ - { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } - ], - OrgCode: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - OrgName: [ - { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } - ] - - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '4', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getOutSourceReportSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getOutSourceReportSearch() - this.getPrentOrganizationNoCompany() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - async getOutSourceReportSearch() { - let tempDate = this.form.receivdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - suppername: this.form.suppername, - type: this.form.type, - receivdate: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - - } - // console.log(data, 1) - const res = await OutSourceReportSearch(data) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getOutSourceReportSearch() - }, - async download() { - let tempDate = this.form.receivdate - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - - const data = { - - wkshopcode: this.form.wkshopcode, - wocode: this.form.wocode, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - stepname: this.form.stepname, - suppername: this.form.suppername, - type: this.form.type, - receivdate: tempDate - } - - const { data: res } = await OutSourceReportExcelSearch(data) - window.location.href = res - }, - // 鏌ヨ - search() { - this.getOutSourceReportSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.wkshopcode = '' - this.form.wocode = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.stepname = '' - this.form.suppername = '' - this.form.type = '' - this.form.receivdate = '' - this.getOutSourceReportSearch() - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.OrgCode = row.org_code - this.dialogForm.OrgName = row.org_name - this.dialogForm.SupUnit = row.parent_id - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - // confirmButtonText: '纭畾', - // cancelButtonText: '鍙栨秷', - // type: 'warning' - // }).then(() => { - // DeleteOrganization({ orgid: row.code }).then(res => { - // if (res.code === '200') { - // this.$message.success('鍒犻櫎鎴愬姛!') - // if (this.form.page > 1 && this.tableData.length === 1) { - // this.form.page-- - // } - // this.getOutSourceReportSearch() - // } - // }) - // }).catch(() => { - // this.$message.info('宸插彇娑堝垹闄�') - // }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.OrgType = '' - this.dialogForm.OrgCode = '' - this.dialogForm.OrgName = '' - this.dialogForm.SupUnit = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - const data = { - OrganCode: this.dialogForm.OrgCode, - OrganName: this.dialogForm.OrgName, - OperType: this.operation === 'add' ? 'Add' : 'Update', - Operator: getCookie('admin') - } - // AddUpdateOrganization(data).then(res => { - // if (res.code === '200') { - // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - // this.dialogVisible = false - // this.getOutSourceReportSearch() - // } else { - // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - // } - // }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> - -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText{ - display: none !important; -} -</style> -<style> - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <!-- <el-form-item label="閿�鍞崟鍙�" style="display: flex;">--> + <!-- <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <!-- <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">--> + <!-- <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />--> + <!-- </el-form-item>--> + <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;"> + <el-input v-model="form.stepname" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="渚涙柟鍚嶇О" style=" display: flex;"> + <el-input v-model="form.suppername" style="width: 200px" placeholder="璇疯緭鍏�" /> + </el-form-item> + <!-- <el-form-item v-show="isExpandForm" label="鎿嶄綔绫诲瀷" style=" display: flex;">--> + <!-- <el-select v-model="form.type" style="width: 200px" placeholder="璇烽�夋嫨">--> + <!-- <el-option--> + <!-- v-for="item in typeArr"--> + <!-- :key="item.code"--> + <!-- :label="item.name"--> + <!-- :value="item.code"--> + <!-- />--> + <!-- </el-select>--> + <!-- </el-form-item>--> + <el-form-item + v-show="isExpandForm" + style="display: flex;align-items: center" + :label="form.type==='F'?'鍙戞枡鏃堕棿':'鏀舵枡鏃堕棿'" + > + <el-date-picker + v-model="form.receivdate" + type="daterange" + :disabled="form.type===''" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + <!-- font-size: 14px!important;--> + <!-- :picker-options="expireTimeOption"--> + + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="160" + sortable="custom" + /> + <!-- <el-table-column--> + <!-- prop="saleOrderCode"--> + <!-- label="閿�鍞崟鍙�"--> + <!-- width="160"--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="160" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partspec" + label="浜у搧瑙勬牸" + width="110" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partspec">{{ row.partspec }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepcode" + label="宸ュ簭缂栫爜" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="stepname" + label="宸ュ簭鍚嶇О" + width="110" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="code" + label="澶栧崗渚涙柟缂栫爜" + width="129" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="name" + label="澶栧崗渚涙柟鍚嶇О" + width="240" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="style" + label="鎿嶄綔绫诲瀷" + width="110" + sortable="custom" + /> + <el-table-column + prop="fqty" + label="鍙戞枡鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="sqty" + label="鏀舵枡鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="ng_qty" + label="涓嶈壇鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="laborbad_qty" + label="宸ュ簾鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="materielbad_qty" + label="鏂欏簾鏁伴噺" + width="110" + sortable="custom" + /> + <el-table-column + prop="out_person" + label="鍙戞枡浜�" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.out_person">{{ row.out_person }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="out_time" + label="鍙戞枡鏃堕棿" + width="160" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.out_time">{{ row.out_time }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="in_person" + label="鏀舵枡浜�" + width="110" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.in_person">{{ row.in_person }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="in_time" + label="鏀舵枡鏃堕棿" + width="160" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.in_time">{{ row.in_time }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- label="鎿嶄綔"--> + <!-- width="120"--> + <!-- fixed="right"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div class="operationClass">--> + <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> + <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> + <!-- </el-tooltip>--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i class="el-icon-delete" @click="del(row)" />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getOutSourceReportSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="缁勭粐缂栫爜" prop="OrgCode"> + <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="缁勭粐鍚嶇О" prop="OrgName"> + <el-input v-model="dialogForm.OrgName" style="width: 200px" /> + </el-form-item> + + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!--瀵煎叆缁勪欢--> + <import-picker + ref="importPickerFunc" + class="importPickerClass" + :shows.sync="shows" + :title="title_value" + :colos="colos" + :code="code" + /> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import ImportPicker from '@/components/ImportPicker' +import { handleDatetime, validateCode } from '@/utils/global' +import { OutSourceReportExcelSearch, OutSourceReportSearch } from '@/api/ReportManager' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'SubcontractingOperation', + components: { + Pagination, ImportPicker + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + + wkshopcode: '', + wocode: '', // 宸ュ崟缂栧彿 + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + stepname: '', // 宸ュ簭鍚嶇О + suppername: '', // 渚涙柟鍚嶇О + type: '', // 鎿嶄綔绫诲瀷 + receivdate: '', // 鏀舵枡鏃堕棿 + prop: 'out_time', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + typeArr: [ + { code: 'F', name: '鍙戞枡' }, + { code: 'S', name: '鏀舵枡' } + ], + wkshopcodeArr: [], + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + OrgType: '', + OrgCode: '', + OrgName: '', + SupUnit: ''// 涓婄骇鍗曚綅 + }, + operation: '', + dialogFormRules: { + OrgType: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] } + ], + OrgCode: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + OrgName: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] } + ] + + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '4', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getOutSourceReportSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getOutSourceReportSearch() + this.getPrentOrganizationNoCompany() + }, + created() { + this.getOutSourceReportSearch() + this.getPrentOrganizationNoCompany() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + async getOutSourceReportSearch() { + let tempDate = this.form.receivdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + suppername: this.form.suppername, + type: this.form.type, + receivdate: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + + } + // console.log(data, 1) + const res = await OutSourceReportSearch(data) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getOutSourceReportSearch() + }, + async download() { + let tempDate = this.form.receivdate + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + + const data = { + + wkshopcode: this.form.wkshopcode, + wocode: this.form.wocode, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + stepname: this.form.stepname, + suppername: this.form.suppername, + type: this.form.type, + receivdate: tempDate + } + + const { data: res } = await OutSourceReportExcelSearch(data) + window.location.href = res + }, + // 鏌ヨ + search() { + this.getOutSourceReportSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.wkshopcode = '' + this.form.wocode = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.stepname = '' + this.form.suppername = '' + this.form.type = '' + this.form.receivdate = '' + this.getOutSourceReportSearch() + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.OrgCode = row.org_code + this.dialogForm.OrgName = row.org_name + this.dialogForm.SupUnit = row.parent_id + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + // confirmButtonText: '纭畾', + // cancelButtonText: '鍙栨秷', + // type: 'warning' + // }).then(() => { + // DeleteOrganization({ orgid: row.code }).then(res => { + // if (res.code === '200') { + // this.$message.success('鍒犻櫎鎴愬姛!') + // if (this.form.page > 1 && this.tableData.length === 1) { + // this.form.page-- + // } + // this.getOutSourceReportSearch() + // } + // }) + // }).catch(() => { + // this.$message.info('宸插彇娑堝垹闄�') + // }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.OrgType = '' + this.dialogForm.OrgCode = '' + this.dialogForm.OrgName = '' + this.dialogForm.SupUnit = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + const data = { + OrganCode: this.dialogForm.OrgCode, + OrganName: this.dialogForm.OrgName, + OperType: this.operation === 'add' ? 'Add' : 'Update', + Operator: getCookie('admin') + } + // AddUpdateOrganization(data).then(res => { + // if (res.code === '200') { + // this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + // this.dialogVisible = false + // this.getOutSourceReportSearch() + // } else { + // this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + // } + // }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> + +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText{ + display: none !important; +} +</style> +<style> + +.el-table .custom-row { + background: #f8f8fa; +} +</style> diff --git a/src/views/statistic/workOrderProcess.vue b/src/views/statistic/workOrderProcess.vue index 015e22e..b3f6729 100644 --- a/src/views/statistic/workOrderProcess.vue +++ b/src/views/statistic/workOrderProcess.vue @@ -1,473 +1,479 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> - <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - - <el-form-item label="閿�鍞崟鍙�" style=" display: flex;"> - <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> - <el-select - v-model="form.wkshopcode" - filterable - :popper-append-to-body="false" - style="width: 200px" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in wkshopcodeArr" - :key="item.torg_code" - :label="item.torg_name" - :value="item.torg_code" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> - <el-select v-model="form.status" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in statusArr" - :key="item.value" - :label="item.label" - :value="item.value" - /> - </el-select> - </el-form-item> - <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> - <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - <!-- <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">--> - <!-- <el-input v-model="form.wkshopname" placeholder="璇疯緭鍏�" style="width: 200px" />--> - <!-- </el-form-item>--> - <el-form-item v-show="isExpandForm" label="浜у搧缂栫爜" style=" display: flex;"> - <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> - <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> - <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> - <el-date-picker - v-model="form.lm_date" - type="daterange" - range-separator="~" - class="timeMini" - size="mini" - style="width: 200px;display: flex;line-height: 34px;height: 34px;" - :clearable="false" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - /> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - > - <svg-icon - v-show="mouseHoverType==='mouseout'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" - @mouseenter="mouseHoverType=$event.type" - /> - <svg-icon - v-show="mouseHoverType==='mouseenter'" - style="cursor: pointer" - :icon-class="!isExpandForm?'doubleDown':'doubleUp'" - @click="isExpandForm=!isExpandForm" - @mouseout="mouseHoverType=$event.type" - /> - </div> - </div> - - <div class="elTableDiv"> - <el-table - ref="tableDataRef" - class="tableFixed custom-table-class" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="lm_date" - label="鍗曟嵁鏃ユ湡" - width="105" - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <el-table-column - prop="status" - label="宸ュ崟鐘舵��" - width="105" - sortable="custom" - /> - <el-table-column - prop="wo_code" - label="宸ュ崟缂栧彿" - width="155" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="saleOrderCode" - label="閿�鍞崟鍙�" - width="135" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partcode" - label="浜у搧缂栫爜" - width="105" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partname" - label="浜у搧鍚嶇О" - width="155" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="partpesc" - label="浜у搧瑙勬牸" - width="105" - show-tooltip-when-overflow - sortable="custom" - > - <template slot-scope="{row}"> - <div v-if="row.partpesc">{{ row.partpesc }}</div> - <div v-else>/</div> - </template> - </el-table-column> - <!-- <el-table-column--> - <!-- prop="wkshp_code"--> - <!-- label="杞﹂棿缂栫爜"--> - <!-- width="130"--> - <!-- show-tooltip-when-overflow--> - <!-- sortable="custom"--> - <!-- />--> - <el-table-column - prop="wkshp_name" - label="杞﹂棿鍚嶇О" - width="130" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="plan_qty" - label="浠诲姟鏁伴噺" - width="105" - show-tooltip-when-overflow - sortable="custom" - /> - <el-table-column - prop="concat_name" - label="鐢熶骇杩涘害" - min-width="521" - sortable="custom" - > - <!-- show-tooltip-when-overflow--> - - <template slot-scope="{row}"> - <div style="min-width:500px;display: flex;overflow-x: auto;overflow-y: hidden;height: 65px;"> - <div - v-for="item in row.concat_name.split(',')" - :key="item+row.wo_code" - style="display: flex;align-items: center;" - > - <!-- padding:0px 0px 10px 0px;--> - - <div - style="position: relative;display: flex;flex-direction: column;width: 120px;text-align: center;align-items: center;margin-left:10px" - > - <div style="width: 120px;" class="ellipsis">{{ item.split('/')[0] }}</div> - <el-progress - :text-inside="true" - :stroke-width="18" - color="#2FD04F" - define-back-color="rgba(144,147,153,0.5)" - :percentage="parseFloat((parseFloat(item.split('/')[1])*100/parseFloat(row.plan_qty)).toFixed(2))" - style="width: 120px;margin: 0 2px;" - /> - - <div style="position: absolute;top:22px;">{{ parseFloat(item.split('/')[1]) }}/{{ - row.plan_qty - }} - </div> - - </div> - - </div> - </div> - - </template> - </el-table-column> - - <!-- <el-table-column--> - <!-- label="鎿嶄綔"--> - <!-- width="120"--> - <!-- fixed="right"--> - <!-- >--> - <!-- <template slot-scope="{row}">--> - <!-- <div class="operationClass">--> - <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> - <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> - <!-- </el-tooltip>--> - <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> - <!-- <i class="el-icon-delete" @click="del(row)" />--> - <!-- </el-tooltip>--> - <!-- </div>--> - <!-- </template>--> - <!-- </el-table-column>--> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getProductionScheduleReportSearch" - /> - </div> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { handleDatetime } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { - ProductionScheduleReportExcelSearch, - ProductionScheduleReportSearch -} from '@/api/ReportManager' -import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' - -export default { - name: 'WorkOrderProcess', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - mouseHoverType: 'mouseout', - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - socode: '', // 閿�鍞崟鍙� - status: '', // 宸ュ崟鐘舵�� - wocode: '', // 宸ュ崟缂栧彿 - wkshopcode: '', // 宸ヨ壓璺嚎缂栫爜 - wkshopname: '', // 宸ヨ壓璺嚎鍚嶇О - partcode: '', // 浜у搧缂栫爜 - partname: '', // 浜у搧鍚嶇О - partspec: '', // 瑙勬牸鍨嬪彿 - lm_date: '', // 鍗曟嵁鏃ユ湡 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - statusArr: [ - { label: '鏈紑濮�', value: 'NOSTART' }, - { label: '鎵ц涓�', value: 'START' }, - { label: '宸插畬鎴�', value: 'CLOSED' } - ], - wkshopcodeArr: [], - - total: 10, - tableData: [] - - } - }, - - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getProductionScheduleReportSearch() - this.getPrentOrganizationNoCompany() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - async getPrentOrganizationNoCompany() { - const { data: res } = await PrentOrganizationNoCompany() - this.wkshopcodeArr = res - }, - async getProductionScheduleReportSearch() { - let tempDate = this.form.lm_date - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - socode: this.form.socode, - status: this.form.status, - wocode: this.form.wocode, - wkshopcode: this.form.wkshopcode, - wkshopname: this.form.wkshopname, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - lm_date: tempDate, - prop: this.form.prop, - order: this.form.order, - page: this.form.page, - rows: this.form.rows - } - - const res = await ProductionScheduleReportSearch(data) - this.tableData = res.data - this.total = res.count - }, - - // 瀵煎嚭 - async download() { - let tempDate = this.form.lm_date - if (tempDate.length > 0) { - tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) - } - const data = { - socode: this.form.socode, - status: this.form.status, - wocode: this.form.wocode, - wkshopcode: this.form.wkshopcode, - wkshopname: this.form.wkshopname, - partcode: this.form.partcode, - partname: this.form.partname, - partspec: this.form.partspec, - lm_date: tempDate - } - - const res = await ProductionScheduleReportExcelSearch(data) - // console.log(res) - window.location.href = res.data - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getProductionScheduleReportSearch() - }, - // 鏌ヨ - search() { - this.getProductionScheduleReportSearch() - }, - // 閲嶇疆 - reset() { - this.form.socode = '' - this.form.status = '' - this.form.wocode = '' - this.form.wkshopcode = '' - this.form.wkshopname = '' - this.form.partcode = '' - this.form.partname = '' - this.form.partspec = '' - this.form.lm_date = '' - this.getProductionScheduleReportSearch() - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 255 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - } - } -} -</script> -<style scoped lang="scss"> -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -::v-deep .el-range__icon { - line-height: 28px !important; -} - -::v-deep .el-range-separator { - line-height: 28px !important; -} - -::v-deep .el-range-input { - font-size: 14px; -} - -::v-deep .el-range-separator { - display: flex; - justify-content: center; - align-items: center; -} - -::v-deep .el-progress-bar__innerText { - display: none !important; -} - -//.custom-table-class { -// ::v-deep .el-table__row { -// height: 80px; -// line-height:80px; -// } -//} - -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button> + <!-- <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>--> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + + <el-form-item label="閿�鍞崟鍙�" style=" display: flex;"> + <el-input v-model="form.socode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;"> + <el-select + v-model="form.wkshopcode" + filterable + :popper-append-to-body="false" + style="width: 200px" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in wkshopcodeArr" + :key="item.torg_code" + :label="item.torg_name" + :value="item.torg_code" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟鐘舵��" style=" display: flex;"> + <el-select v-model="form.status" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in statusArr" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + <el-form-item label="宸ュ崟缂栧彿" style=" display: flex;"> + <el-input v-model="form.wocode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + <!-- <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">--> + <!-- <el-input v-model="form.wkshopname" placeholder="璇疯緭鍏�" style="width: 200px" />--> + <!-- </el-form-item>--> + <el-form-item v-show="isExpandForm" label="浜у搧缂栫爜" style=" display: flex;"> + <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="浜у搧鍚嶇О" style=" display: flex;"> + <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="瑙勬牸鍨嬪彿" style=" display: flex;"> + <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center"> + <el-date-picker + v-model="form.lm_date" + type="daterange" + range-separator="~" + class="timeMini" + size="mini" + style="width: 200px;display: flex;line-height: 34px;height: 34px;" + :clearable="false" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + /> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + > + <svg-icon + v-show="mouseHoverType==='mouseout'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'" + @mouseenter="mouseHoverType=$event.type" + /> + <svg-icon + v-show="mouseHoverType==='mouseenter'" + style="cursor: pointer" + :icon-class="!isExpandForm?'doubleDown':'doubleUp'" + @click="isExpandForm=!isExpandForm" + @mouseout="mouseHoverType=$event.type" + /> + </div> + </div> + + <div class="elTableDiv"> + <el-table + ref="tableDataRef" + class="tableFixed custom-table-class" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="lm_date" + label="鍗曟嵁鏃ユ湡" + width="105" + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <el-table-column + prop="status" + label="宸ュ崟鐘舵��" + width="105" + sortable="custom" + /> + <el-table-column + prop="wo_code" + label="宸ュ崟缂栧彿" + width="155" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="saleOrderCode" + label="閿�鍞崟鍙�" + width="135" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partcode" + label="浜у搧缂栫爜" + width="105" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partname" + label="浜у搧鍚嶇О" + width="155" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="partpesc" + label="浜у搧瑙勬牸" + width="105" + show-tooltip-when-overflow + sortable="custom" + > + <template slot-scope="{row}"> + <div v-if="row.partpesc">{{ row.partpesc }}</div> + <div v-else>/</div> + </template> + </el-table-column> + <!-- <el-table-column--> + <!-- prop="wkshp_code"--> + <!-- label="杞﹂棿缂栫爜"--> + <!-- width="130"--> + <!-- show-tooltip-when-overflow--> + <!-- sortable="custom"--> + <!-- />--> + <el-table-column + prop="wkshp_name" + label="杞﹂棿鍚嶇О" + width="130" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="plan_qty" + label="浠诲姟鏁伴噺" + width="105" + show-tooltip-when-overflow + sortable="custom" + /> + <el-table-column + prop="concat_name" + label="鐢熶骇杩涘害" + min-width="521" + sortable="custom" + > + <!-- show-tooltip-when-overflow--> + + <template slot-scope="{row}"> + <div style="min-width:500px;display: flex;overflow-x: auto;overflow-y: hidden;height: 65px;"> + <div + v-for="item in row.concat_name.split(',')" + :key="item+row.wo_code" + style="display: flex;align-items: center;" + > + <!-- padding:0px 0px 10px 0px;--> + + <div + style="position: relative;display: flex;flex-direction: column;width: 120px;text-align: center;align-items: center;margin-left:10px" + > + <div style="width: 120px;" class="ellipsis">{{ item.split('/')[0] }}</div> + <el-progress + :text-inside="true" + :stroke-width="18" + color="#2FD04F" + define-back-color="rgba(144,147,153,0.5)" + :percentage="parseFloat((parseFloat(item.split('/')[1])*100/parseFloat(row.plan_qty)).toFixed(2))" + style="width: 120px;margin: 0 2px;" + /> + + <div style="position: absolute;top:22px;">{{ parseFloat(item.split('/')[1]) }}/{{ + row.plan_qty + }} + </div> + + </div> + + </div> + </div> + + </template> + </el-table-column> + + <!-- <el-table-column--> + <!-- label="鎿嶄綔"--> + <!-- width="120"--> + <!-- fixed="right"--> + <!-- >--> + <!-- <template slot-scope="{row}">--> + <!-- <div class="operationClass">--> + <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">--> + <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />--> + <!-- </el-tooltip>--> + <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">--> + <!-- <i class="el-icon-delete" @click="del(row)" />--> + <!-- </el-tooltip>--> + <!-- </div>--> + <!-- </template>--> + <!-- </el-table-column>--> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getProductionScheduleReportSearch" + /> + </div> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { handleDatetime } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { + ProductionScheduleReportExcelSearch, + ProductionScheduleReportSearch +} from '@/api/ReportManager' +import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData' + +export default { + name: 'WorkOrderProcess', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + mouseHoverType: 'mouseout', + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + socode: '', // 閿�鍞崟鍙� + status: '', // 宸ュ崟鐘舵�� + wocode: '', // 宸ュ崟缂栧彿 + wkshopcode: '', // 宸ヨ壓璺嚎缂栫爜 + wkshopname: '', // 宸ヨ壓璺嚎鍚嶇О + partcode: '', // 浜у搧缂栫爜 + partname: '', // 浜у搧鍚嶇О + partspec: '', // 瑙勬牸鍨嬪彿 + lm_date: '', // 鍗曟嵁鏃ユ湡 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + statusArr: [ + { label: '鏈紑濮�', value: 'NOSTART' }, + { label: '鎵ц涓�', value: 'START' }, + { label: '宸插畬鎴�', value: 'CLOSED' } + ], + wkshopcodeArr: [], + + total: 10, + tableData: [] + + } + }, + + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getProductionScheduleReportSearch() + this.getPrentOrganizationNoCompany() + }, + created() { + this.getProductionScheduleReportSearch() + this.getPrentOrganizationNoCompany() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + async getPrentOrganizationNoCompany() { + const { data: res } = await PrentOrganizationNoCompany() + this.wkshopcodeArr = res + }, + async getProductionScheduleReportSearch() { + let tempDate = this.form.lm_date + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + socode: this.form.socode, + status: this.form.status, + wocode: this.form.wocode, + wkshopcode: this.form.wkshopcode, + wkshopname: this.form.wkshopname, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + lm_date: tempDate, + prop: this.form.prop, + order: this.form.order, + page: this.form.page, + rows: this.form.rows + } + + const res = await ProductionScheduleReportSearch(data) + this.tableData = res.data + this.total = res.count + }, + + // 瀵煎嚭 + async download() { + let tempDate = this.form.lm_date + if (tempDate.length > 0) { + tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) + } + const data = { + socode: this.form.socode, + status: this.form.status, + wocode: this.form.wocode, + wkshopcode: this.form.wkshopcode, + wkshopname: this.form.wkshopname, + partcode: this.form.partcode, + partname: this.form.partname, + partspec: this.form.partspec, + lm_date: tempDate + } + + const res = await ProductionScheduleReportExcelSearch(data) + // console.log(res) + window.location.href = res.data + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getProductionScheduleReportSearch() + }, + // 鏌ヨ + search() { + this.getProductionScheduleReportSearch() + }, + // 閲嶇疆 + reset() { + this.form.socode = '' + this.form.status = '' + this.form.wocode = '' + this.form.wkshopcode = '' + this.form.wkshopname = '' + this.form.partcode = '' + this.form.partname = '' + this.form.partspec = '' + this.form.lm_date = '' + this.getProductionScheduleReportSearch() + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 255 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + } + } +} +</script> +<style scoped lang="scss"> +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +::v-deep .el-range__icon { + line-height: 28px !important; +} + +::v-deep .el-range-separator { + line-height: 28px !important; +} + +::v-deep .el-range-input { + font-size: 14px; +} + +::v-deep .el-range-separator { + display: flex; + justify-content: center; + align-items: center; +} + +::v-deep .el-progress-bar__innerText { + display: none !important; +} + +//.custom-table-class { +// ::v-deep .el-table__row { +// height: 80px; +// line-height:80px; +// } +//} + +</style> diff --git a/src/views/systemSetting/encodingRules.vue b/src/views/systemSetting/encodingRules.vue index 7b1cc1a..1ff91b8 100644 --- a/src/views/systemSetting/encodingRules.vue +++ b/src/views/systemSetting/encodingRules.vue @@ -1,465 +1,471 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup"> - <el-button - v-waves - :style="{visibility:$buttoncode.includes('Add')?'':'hidden'}" - type="primary" - icon="el-icon-circle-plus-outline" - @click="add('add')" - >鏂板</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鑿滃崟鍚嶇О" style=" display: flex;"> - <el-input v-model="form.rightname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鍥哄畾瀛楃" style=" display: flex;"> - <el-input v-model="form.prefix" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="getEncodingRules">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - <div - class="bodyTopFormExpand" - style="height:5px" - > - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseout'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> - <!-- @mouseenter="mouseHoverType=$event.type"--> - <!-- />--> - <!-- <svg-icon--> - <!-- v-show="mouseHoverType==='mouseenter'"--> - <!-- style="cursor: pointer"--> - <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> - <!-- @click="isExpandForm=!isExpandForm"--> - <!-- @mouseout="mouseHoverType=$event.type"--> - <!-- />--> - </div> - </div> - - <div class="elTableDiv"> - - <el-table - ref="tableDataRef" - class="tableFixed" - :data="tableData" - :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" - border - row-class-name="custom-row" - :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - <el-table-column - prop="rowNum" - width="50" - fixed - label="搴忓彿" - /> - <el-table-column - prop="menucode" - label="鑿滃崟缂栫爜" - sortable="custom" - /> - <el-table-column - prop="menuname" - label="鑿滃崟鍚嶇О" - sortable="custom" - /> - <el-table-column - prop="Type" - label="鑿滃崟绫诲瀷" - sortable="custom" - /> - <el-table-column - prop="prefix" - label="鍥哄畾瀛楃" - sortable="custom" - /> - <el-table-column - prop="filingdate" - label="缂栫爜鏍煎紡" - sortable="custom" - /> - <el-table-column - prop="incbit" - label="鑷浣嶆暟" - sortable="custom" - /> - <el-table-column - prop="value" - label="娴佹按鍙�" - width="160" - sortable="custom" - /> - <el-table-column - v-if="$buttoncode.toString().length" - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - class="el-icon-edit-outline" - :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Update')?'':'none'}" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i - class="el-icon-delete" - :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Delete')?'':'none'}" - @click="del(row)" - /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getEncodingRules" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="15vh" - @closed="handleClose" - @close="handleClose" - > - <el-form - ref="dialogForm" - inline - :rules="dialogFormRules" - style="display: flex;flex-direction: column" - :model="dialogForm" - label-width="80px" - > - <el-form-item label="鑿滃崟绫诲瀷" required> - <el-radio-group v-model="dialogForm.type" @change="radioChange"> - <el-radio label="PC" name="PC" /> - <el-radio label="APP" name="APP" /> - </el-radio-group> - </el-form-item> - <el-form-item label="鑿滃崟鍚嶇О" required> - <el-cascader - ref="cascader" - :options="menuOptions" - filterable - :props="defaultProps" - :show-all-levels="false" - /> - </el-form-item> - <el-form-item label="鍥哄畾瀛楃" prop="prefix"> - <el-input v-model="dialogForm.prefix" style="width: 200px" /> - </el-form-item> - <el-form-item prop="filingdate" label="缂栫爜鏍煎紡"> - <el-select - v-model="dialogForm.filingdate" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in dateType" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - - <el-form-item label="鑷浣嶆暟" prop="incbit" required> - <el-input v-model="dialogForm.incbit" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> - </el-form-item> - - <el-form-item label="缂栫爜棰勮"> - {{ encodingPre }} - <!-- <el-input v-model="dialogForm.OrgName" style="width: 200px" />--> - </el-form-item> - </el-form> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { getCookie } from '@/utils/auth' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import { CodeMenuSelect, DeleteEncodingRules, EncodingRules, SaveEncodingRules } from '@/api/systemSetting' -import arrayToTree from 'array-to-tree' - -export default { - name: 'ReportList', - components: { - Pagination - }, - directives: { elDragDialog, waves }, - data() { - return { - isExpandForm: false, - mainHeight: 0, - tableHeight: 0, - form: { - rightname: '', // 缂栫爜鍚嶇О - prefix: '', // 鍥哄畾瀛楃 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - total: 10, - tableData: [], - dialogVisible: false, - dialogForm: { - type: 'PC', // 鑿滃崟绫诲瀷 - rightcode: '', // 鑿滃崟缂栫爜 - rightname: '', // 鑿滃崟鍚嶇О - incbit: '1', // 鑷浣嶆暟 - filingdate: '', // 缂栫爜鏍煎紡 - prefix: ''// 鍥哄畾瀛楃 - }, - encodingPre: '', // 缂栫爜棰勮 - dateType: [ - { name: '骞存湀鏃�', code: '骞存湀鏃�' }, - { name: '骞存湀', code: '骞存湀' }, - { name: '骞�', code: '骞�' } - ], - menuOptionsAll: [], - menuOptions: [], - defaultProps: { - expandTrigger: 'hover', - value: 'menucode', - label: 'menuname' - }, - operation: '', - dialogFormRules: { - prefix: [ - { required: true, message: '璇疯緭鍏ュ浐瀹氬瓧绗�', trigger: ['blur', 'change'] } - ], - // OrgCode: [ - // { required: true, validator: validateCode, trigger: ['blur', 'change'] } - // ], - filingdate: [ - { required: true, message: '璇烽�夋嫨缂栫爜鏍煎紡', trigger: ['blur', 'change'] } - ], - incbit: [ - { required: true, message: '璇疯緭鍏ヨ嚜澧炰綅鏁�', trigger: ['blur', 'change'] } - ] - - } - } - }, - watch: { - dialogForm: { - handler(newValue, oldValue) { - const date = new Date() - let newDate = '' - if (newValue.filingdate === '骞存湀鏃�') { - newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0') + '' + (date.getDate() + '').padStart(2, '0') - } else if (newValue.filingdate === '骞存湀') { - newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0') - } else if (newValue.filingdate === '骞�') { - newDate = date.getFullYear().toString().substring(2, 4) + '' - } - this.encodingPre = newValue.prefix + '' + newDate + '' + (1 + '').padStart(newValue.incbit, '0') - }, - immediate: true, - deep: true - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.getEncodingRules() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - - this.getCodeMenuSelect() - }, - methods: { - async getCodeMenuSelect() { - const { data: res } = await CodeMenuSelect() - this.menuOptionsAll = arrayToTree(res, { - parentProperty: 'parent_id', - customID: 'menucode', - childrenProperty: 'children' - }) - // this.menuOptions = this.menuOptionsAll.filter(i => i.Type === this.dialogForm.type) - }, - radioChange() { - this.menuOptions = this.menuOptionsAll.filter(i => i.Type === this.dialogForm.type) - }, - async getEncodingRules() { - const res = await EncodingRules(this.form) - this.tableData = res.data - this.total = res.count - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getEncodingRules() - }, - // 閲嶇疆 - reset() { - this.form.rightname = '' - this.form.prefix = '' - this.getEncodingRules() - }, - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - }, - // 淇敼鎸夐挳 - edit(operation, row) { - this.operation = operation - this.dialogVisible = true - - this.$nextTick(() => { - this.dialogForm.type = row.Type - this.radioChange() - - let parentCode = '' - this.menuOptions.forEach(item => { - if (item.children && item.children.length) { - item.children.forEach(it => { - if (it.menucode === row.menucode) { - parentCode = it.parent_id - } - }) - } - }) - console.log(parentCode, row.menucode) - this.$refs.cascader.checkedValue = [parentCode, row.menucode] - this.dialogForm.rightcode = row.menucode - this.dialogForm.incbit = row.incbit - this.dialogForm.filingdate = row.filingdate - this.dialogForm.prefix = row.prefix - }) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteEncodingRules({ menucode: row.menucode }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getEncodingRules() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.rightcode = '' - this.dialogForm.rightname = '' - this.dialogForm.incbit = '1' - this.dialogForm.filingdate = '' - this.dialogForm.prefix = '' - this.$refs.cascader.checkedValue = '' - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - const rightcode = this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1] - this.dialogForm.rightcode = rightcode - this.dialogForm.rightname = this.menuOptions[this.menuOptions.findIndex(i => i.menucode === this.$refs.cascader.checkedValue[0])].children.find(i => i.menucode === rightcode).menuname - SaveEncodingRules(this.dialogForm).then(res => { - if (res.code === '200') { - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.dialogVisible = false - this.$store.state.app.buttonIsDisabled = false - this.getEncodingRules() - } else { - this.$store.state.app.buttonIsDisabled = false - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 240 - this.$refs.tableDataRef.doLayout() - }) - } - } -} -</script> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup"> + <el-button + v-waves + :style="{visibility:$buttoncode.includes('Add')?'':'hidden'}" + type="primary" + icon="el-icon-circle-plus-outline" + @click="add('add')" + >鏂板</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鑿滃崟鍚嶇О" style=" display: flex;"> + <el-input v-model="form.rightname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍥哄畾瀛楃" style=" display: flex;"> + <el-input v-model="form.prefix" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="getEncodingRules">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + <div + class="bodyTopFormExpand" + style="height:5px" + > + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseout'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"--> + <!-- @mouseenter="mouseHoverType=$event.type"--> + <!-- />--> + <!-- <svg-icon--> + <!-- v-show="mouseHoverType==='mouseenter'"--> + <!-- style="cursor: pointer"--> + <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"--> + <!-- @click="isExpandForm=!isExpandForm"--> + <!-- @mouseout="mouseHoverType=$event.type"--> + <!-- />--> + </div> + </div> + + <div class="elTableDiv"> + + <el-table + ref="tableDataRef" + class="tableFixed" + :data="tableData" + :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" + border + row-class-name="custom-row" + :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + <el-table-column + prop="rowNum" + width="50" + fixed + label="搴忓彿" + /> + <el-table-column + prop="menucode" + label="鑿滃崟缂栫爜" + sortable="custom" + /> + <el-table-column + prop="menuname" + label="鑿滃崟鍚嶇О" + sortable="custom" + /> + <el-table-column + prop="Type" + label="鑿滃崟绫诲瀷" + sortable="custom" + /> + <el-table-column + prop="prefix" + label="鍥哄畾瀛楃" + sortable="custom" + /> + <el-table-column + prop="filingdate" + label="缂栫爜鏍煎紡" + sortable="custom" + /> + <el-table-column + prop="incbit" + label="鑷浣嶆暟" + sortable="custom" + /> + <el-table-column + prop="value" + label="娴佹按鍙�" + width="160" + sortable="custom" + /> + <el-table-column + v-if="$buttoncode.toString().length" + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + class="el-icon-edit-outline" + :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Update')?'':'none'}" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i + class="el-icon-delete" + :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Delete')?'':'none'}" + @click="del(row)" + /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getEncodingRules" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="15vh" + @closed="handleClose" + @close="handleClose" + > + <el-form + ref="dialogForm" + inline + :rules="dialogFormRules" + style="display: flex;flex-direction: column" + :model="dialogForm" + label-width="80px" + > + <el-form-item label="鑿滃崟绫诲瀷" required> + <el-radio-group v-model="dialogForm.type" @change="radioChange"> + <el-radio label="PC" name="PC" /> + <el-radio label="APP" name="APP" /> + </el-radio-group> + </el-form-item> + <el-form-item label="鑿滃崟鍚嶇О" required> + <el-cascader + ref="cascader" + :options="menuOptions" + filterable + :props="defaultProps" + :show-all-levels="false" + /> + </el-form-item> + <el-form-item label="鍥哄畾瀛楃" prop="prefix"> + <el-input v-model="dialogForm.prefix" style="width: 200px" /> + </el-form-item> + <el-form-item prop="filingdate" label="缂栫爜鏍煎紡"> + <el-select + v-model="dialogForm.filingdate" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in dateType" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + + <el-form-item label="鑷浣嶆暟" prop="incbit" required> + <el-input v-model="dialogForm.incbit" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" /> + </el-form-item> + + <el-form-item label="缂栫爜棰勮"> + {{ encodingPre }} + <!-- <el-input v-model="dialogForm.OrgName" style="width: 200px" />--> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { getCookie } from '@/utils/auth' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import { CodeMenuSelect, DeleteEncodingRules, EncodingRules, SaveEncodingRules } from '@/api/systemSetting' +import arrayToTree from 'array-to-tree' + +export default { + name: 'ReportList', + components: { + Pagination + }, + directives: { elDragDialog, waves }, + data() { + return { + isExpandForm: false, + mainHeight: 0, + tableHeight: 0, + form: { + rightname: '', // 缂栫爜鍚嶇О + prefix: '', // 鍥哄畾瀛楃 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + total: 10, + tableData: [], + dialogVisible: false, + dialogForm: { + type: 'PC', // 鑿滃崟绫诲瀷 + rightcode: '', // 鑿滃崟缂栫爜 + rightname: '', // 鑿滃崟鍚嶇О + incbit: '1', // 鑷浣嶆暟 + filingdate: '', // 缂栫爜鏍煎紡 + prefix: ''// 鍥哄畾瀛楃 + }, + encodingPre: '', // 缂栫爜棰勮 + dateType: [ + { name: '骞存湀鏃�', code: '骞存湀鏃�' }, + { name: '骞存湀', code: '骞存湀' }, + { name: '骞�', code: '骞�' } + ], + menuOptionsAll: [], + menuOptions: [], + defaultProps: { + expandTrigger: 'hover', + value: 'menucode', + label: 'menuname' + }, + operation: '', + dialogFormRules: { + prefix: [ + { required: true, message: '璇疯緭鍏ュ浐瀹氬瓧绗�', trigger: ['blur', 'change'] } + ], + // OrgCode: [ + // { required: true, validator: validateCode, trigger: ['blur', 'change'] } + // ], + filingdate: [ + { required: true, message: '璇烽�夋嫨缂栫爜鏍煎紡', trigger: ['blur', 'change'] } + ], + incbit: [ + { required: true, message: '璇疯緭鍏ヨ嚜澧炰綅鏁�', trigger: ['blur', 'change'] } + ] + + } + } + }, + watch: { + dialogForm: { + handler(newValue, oldValue) { + const date = new Date() + let newDate = '' + if (newValue.filingdate === '骞存湀鏃�') { + newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0') + '' + (date.getDate() + '').padStart(2, '0') + } else if (newValue.filingdate === '骞存湀') { + newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0') + } else if (newValue.filingdate === '骞�') { + newDate = date.getFullYear().toString().substring(2, 4) + '' + } + this.encodingPre = newValue.prefix + '' + newDate + '' + (1 + '').padStart(newValue.incbit, '0') + }, + immediate: true, + deep: true + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.getEncodingRules() + this.getCodeMenuSelect() + }, + created() { + this.getEncodingRules() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + + this.getCodeMenuSelect() + }, + methods: { + async getCodeMenuSelect() { + const { data: res } = await CodeMenuSelect() + this.menuOptionsAll = arrayToTree(res, { + parentProperty: 'parent_id', + customID: 'menucode', + childrenProperty: 'children' + }) + // this.menuOptions = this.menuOptionsAll.filter(i => i.Type === this.dialogForm.type) + }, + radioChange() { + this.menuOptions = this.menuOptionsAll.filter(i => i.Type === this.dialogForm.type) + }, + async getEncodingRules() { + const res = await EncodingRules(this.form) + this.tableData = res.data + this.total = res.count + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getEncodingRules() + }, + // 閲嶇疆 + reset() { + this.form.rightname = '' + this.form.prefix = '' + this.getEncodingRules() + }, + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + }, + // 淇敼鎸夐挳 + edit(operation, row) { + this.operation = operation + this.dialogVisible = true + + this.$nextTick(() => { + this.dialogForm.type = row.Type + this.radioChange() + + let parentCode = '' + this.menuOptions.forEach(item => { + if (item.children && item.children.length) { + item.children.forEach(it => { + if (it.menucode === row.menucode) { + parentCode = it.parent_id + } + }) + } + }) + console.log(parentCode, row.menucode) + this.$refs.cascader.checkedValue = [parentCode, row.menucode] + this.dialogForm.rightcode = row.menucode + this.dialogForm.incbit = row.incbit + this.dialogForm.filingdate = row.filingdate + this.dialogForm.prefix = row.prefix + }) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteEncodingRules({ menucode: row.menucode }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getEncodingRules() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.rightcode = '' + this.dialogForm.rightname = '' + this.dialogForm.incbit = '1' + this.dialogForm.filingdate = '' + this.dialogForm.prefix = '' + this.$refs.cascader.checkedValue = '' + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + const rightcode = this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1] + this.dialogForm.rightcode = rightcode + this.dialogForm.rightname = this.menuOptions[this.menuOptions.findIndex(i => i.menucode === this.$refs.cascader.checkedValue[0])].children.find(i => i.menucode === rightcode).menuname + SaveEncodingRules(this.dialogForm).then(res => { + if (res.code === '200') { + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.dialogVisible = false + this.$store.state.app.buttonIsDisabled = false + this.getEncodingRules() + } else { + this.$store.state.app.buttonIsDisabled = false + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 240 + this.$refs.tableDataRef.doLayout() + }) + } + } +} +</script> diff --git a/src/views/systemSetting/processSetting.vue b/src/views/systemSetting/processSetting.vue index 105d0f9..5849006 100644 --- a/src/views/systemSetting/processSetting.vue +++ b/src/views/systemSetting/processSetting.vue @@ -1,228 +1,233 @@ -<template> - <div> - <div class="body" style="padding-top: 10px;" :style="{height:mainHeight+'px'}"> - <el-card class="box-card" :style="{height:(mainHeight-20)+'px'}"> - <div slot="header" style="display: flex;justify-content: flex-end"> - <!-- <span>娴佺▼璁剧疆</span>--> - <el-button type="primary" @click="save">淇濆瓨</el-button> - </div> - <div class="main"> - <div class="block"> - <div class="block-title">宸ヨ壓绠$悊</div> - <div class="block-content"> - <div class="font"> - <div>宸ヨ壓璺嚎:</div> - <el-tooltip class="item" effect="dark" content="宸ュ崟鏄惁鍚敤宸ヨ壓璺嚎鐢熶骇" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="route" - style="margin-left: 10px;" - /> - </div> - - <div class="font"> - <div>鎸夊簭鐢熶骇:</div> - <el-tooltip class="item" effect="dark" content="宸ュ簭鏄惁鏈夊簭鐢熶骇" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="isOrder" - style="margin-left: 10px;" - /> - </div> - - </div> - </div> - <div class="block"> - <div class="block-title">SOP绠$悊</div> - <div class="block-content"> - <div class="font"> - <div>璁惧SOP:</div> - <el-tooltip class="item" effect="dark" content="鏄惁鍚敤璁惧SOP绠$悊" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="device" - style="margin-left: 10px;" - /> - </div> - <div class="font"> - <div>宸ヨ壓SOP:</div> - <el-tooltip class="item" effect="dark" content="鏄惁鍚敤宸ヨ壓SOP绠$悊" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="tech" - style="margin-left: 10px;" - /> - </div> - <div class="font"> - <div>鍗曟嵁SOP:</div> - <el-tooltip class="item" effect="dark" content="鏄惁鍚敤鍗曟嵁SOP绠$悊" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="workOrder" - style="margin-left: 10px;" - /> - </div> - - </div> - </div> - <div class="block"> - <div class="block-title">娴佽浆鏍囩鎵撳嵃</div> - <div class="block-content"> - <div class="font"> - <div>閫愰亾鎵撳嵃:</div> - <el-tooltip class="item" effect="dark" content="鏄惁閫愰亾鎵撳嵃" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="every" - style="margin-left: 10px;" - @change="everyChange" - /> - </div> - <div class="font"> - <div>鏈亾鎵撳嵃:</div> - <el-tooltip class="item" effect="dark" content="鏄惁鏈亾鎵撳嵃" placement="top"> - <i class="el-icon-question" /> - </el-tooltip> - <el-switch - v-model="last" - style="margin-left: 10px;" - :disabled="every" - /> - </div> - </div> - </div> - - </div> - </el-card> - - </div> - </div> -</template> - -<script> -import { SaveSystemProcConfig } from '@/api/systemSetting' -import { logout } from '@/api/user' - -export default { - name: 'ProcessSetting', - data() { - return { - mainHeight: 0, - route: false, // 宸ヨ壓璺嚎 - - isOrder: true, // 鏄惁鎸夊簭鐢熶骇 - device: true, // 璁惧 - tech: true, // 宸ヨ壓 - workOrder: true, // 宸ュ崟 - every: false, // 鏄惁閫愰亾鎵撳嵃 - last: false // 鏄惁鏈亾鎵撳嵃 - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - this.init() - }, - methods: { - init() { - const mesSetting = JSON.parse(localStorage.getItem('mesSetting')) - if (mesSetting) { - this.route = mesSetting.route - - this.isOrder = mesSetting.isOrder - this.device = mesSetting.device - this.tech = mesSetting.tech - this.workOrder = mesSetting.workOrder - this.every = mesSetting.every - this.last = mesSetting.last - } - }, - save() { - this.$confirm('鏄惁纭淇濆瓨?淇濆瓨鎴愬姛涔嬪悗鑷姩璺宠浆鐧诲綍椤甸噸鏂扮櫥褰�', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - const data = { - route: this.route, // 宸ヨ壓璺嚎 - - isOrder: this.isOrder, // 鏄惁鎸夊簭鐢熶骇 - device: this.device, // 璁惧 - tech: this.tech, // 宸ヨ壓 - workOrder: this.workOrder, // 宸ュ崟 - every: this.every, // 鏄惁閫愰亾鎵撳嵃 - last: this.last // 鏄惁鏈亾鎵撳嵃 - } - SaveSystemProcConfig({ mesSetting: data }).then(res => { - if (res.code === '200') { - localStorage.setItem('mesSetting', JSON.stringify(data)) - this.$notify.success('淇濆瓨鎴愬姛锛�') - - setTimeout(() => { - logout().then(res => { - localStorage.removeItem('token') - this.$router.push({ path: this.redirect || '/' }) - }) - }, 2000) - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堜繚瀛橈紒') - }) - }, - everyChange(val) { - if (val) { - this.last = true - } - }, - - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - }) - } - } -} -</script> - -<style scoped> -.main { - display: flex; - flex-direction: column; -} - -.block { - height: 100px; -} - -.block-title { - -} - -.block-content { - padding: 20px; - display: flex; - align-items: center; -} - -.font { - color: #606266; - font-size: 14px; - display: flex; - align-items: center; - width: 200px; -} - -.el-icon-question { - cursor: pointer; -} -</style> +<template> + <div> + <div class="body" style="padding-top: 10px;" :style="{height:mainHeight+'px'}"> + <el-card class="box-card" :style="{height:(mainHeight-20)+'px'}"> + <div slot="header" style="display: flex;justify-content: flex-end"> + <!-- <span>娴佺▼璁剧疆</span>--> + <el-button type="primary" @click="save">淇濆瓨</el-button> + </div> + <div class="main"> + <div class="block"> + <div class="block-title">宸ヨ壓绠$悊</div> + <div class="block-content"> + <div class="font"> + <div>宸ヨ壓璺嚎:</div> + <el-tooltip class="item" effect="dark" content="宸ュ崟鏄惁鍚敤宸ヨ壓璺嚎鐢熶骇" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="route" + style="margin-left: 10px;" + /> + </div> + + <div class="font"> + <div>鎸夊簭鐢熶骇:</div> + <el-tooltip class="item" effect="dark" content="宸ュ簭鏄惁鏈夊簭鐢熶骇" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="isOrder" + style="margin-left: 10px;" + /> + </div> + + </div> + </div> + <div class="block"> + <div class="block-title">SOP绠$悊</div> + <div class="block-content"> + <div class="font"> + <div>璁惧SOP:</div> + <el-tooltip class="item" effect="dark" content="鏄惁鍚敤璁惧SOP绠$悊" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="device" + style="margin-left: 10px;" + /> + </div> + <div class="font"> + <div>宸ヨ壓SOP:</div> + <el-tooltip class="item" effect="dark" content="鏄惁鍚敤宸ヨ壓SOP绠$悊" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="tech" + style="margin-left: 10px;" + /> + </div> + <div class="font"> + <div>鍗曟嵁SOP:</div> + <el-tooltip class="item" effect="dark" content="鏄惁鍚敤鍗曟嵁SOP绠$悊" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="workOrder" + style="margin-left: 10px;" + /> + </div> + + </div> + </div> + <div class="block"> + <div class="block-title">娴佽浆鏍囩鎵撳嵃</div> + <div class="block-content"> + <div class="font"> + <div>閫愰亾鎵撳嵃:</div> + <el-tooltip class="item" effect="dark" content="鏄惁閫愰亾鎵撳嵃" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="every" + style="margin-left: 10px;" + @change="everyChange" + /> + </div> + <div class="font"> + <div>鏈亾鎵撳嵃:</div> + <el-tooltip class="item" effect="dark" content="鏄惁鏈亾鎵撳嵃" placement="top"> + <i class="el-icon-question" /> + </el-tooltip> + <el-switch + v-model="last" + style="margin-left: 10px;" + :disabled="every" + /> + </div> + </div> + </div> + + </div> + </el-card> + + </div> + </div> +</template> + +<script> +import { SaveSystemProcConfig } from '@/api/systemSetting' +import { logout } from '@/api/user' + +export default { + name: 'ProcessSetting', + data() { + return { + mainHeight: 0, + route: false, // 宸ヨ壓璺嚎 + + isOrder: true, // 鏄惁鎸夊簭鐢熶骇 + device: true, // 璁惧 + tech: true, // 宸ヨ壓 + workOrder: true, // 宸ュ崟 + every: false, // 鏄惁閫愰亾鎵撳嵃 + last: false // 鏄惁鏈亾鎵撳嵃 + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.init() + }, + created() { + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.init() + }, + methods: { + init() { + const mesSetting = JSON.parse(localStorage.getItem('mesSetting')) + if (mesSetting) { + this.route = mesSetting.route + + this.isOrder = mesSetting.isOrder + this.device = mesSetting.device + this.tech = mesSetting.tech + this.workOrder = mesSetting.workOrder + this.every = mesSetting.every + this.last = mesSetting.last + } + }, + save() { + this.$confirm('鏄惁纭淇濆瓨?淇濆瓨鎴愬姛涔嬪悗鑷姩璺宠浆鐧诲綍椤甸噸鏂扮櫥褰�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const data = { + route: this.route, // 宸ヨ壓璺嚎 + + isOrder: this.isOrder, // 鏄惁鎸夊簭鐢熶骇 + device: this.device, // 璁惧 + tech: this.tech, // 宸ヨ壓 + workOrder: this.workOrder, // 宸ュ崟 + every: this.every, // 鏄惁閫愰亾鎵撳嵃 + last: this.last // 鏄惁鏈亾鎵撳嵃 + } + SaveSystemProcConfig({ mesSetting: data }).then(res => { + if (res.code === '200') { + localStorage.setItem('mesSetting', JSON.stringify(data)) + this.$notify.success('淇濆瓨鎴愬姛锛�') + + setTimeout(() => { + logout().then(res => { + localStorage.removeItem('token') + this.$router.push({ path: this.redirect || '/' }) + }) + }, 2000) + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堜繚瀛橈紒') + }) + }, + everyChange(val) { + if (val) { + this.last = true + } + }, + + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + }) + } + } +} +</script> + +<style scoped> +.main { + display: flex; + flex-direction: column; +} + +.block { + height: 100px; +} + +.block-title { + +} + +.block-content { + padding: 20px; + display: flex; + align-items: center; +} + +.font { + color: #606266; + font-size: 14px; + display: flex; + align-items: center; + width: 200px; +} + +.el-icon-question { + cursor: pointer; +} +</style> diff --git a/src/views/workOrder/produceOrderList.vue b/src/views/workOrder/produceOrderList.vue index 6a3e8fc..e0a54e9 100644 --- a/src/views/workOrder/produceOrderList.vue +++ b/src/views/workOrder/produceOrderList.vue @@ -762,6 +762,8 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.getErpOrderSearch() + this.getPrentOrganizationNoCompany() }, created() { this.getErpOrderSearch() diff --git a/src/views/workOrder/workOrderClose.vue b/src/views/workOrder/workOrderClose.vue index 3812729..353c468 100644 --- a/src/views/workOrder/workOrderClose.vue +++ b/src/views/workOrder/workOrderClose.vue @@ -2320,6 +2320,7 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.handleRequest() }, created() { this.handleRequest() diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue index 1f71997..4063fb7 100644 --- a/src/views/workOrder/workOrderList.vue +++ b/src/views/workOrder/workOrderList.vue @@ -2672,6 +2672,7 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.handleRequest() }, created() { this.handleRequest() diff --git a/src/views/workOrder/workOrderSend.vue b/src/views/workOrder/workOrderSend.vue index 6a84a35..131a0dc 100644 --- a/src/views/workOrder/workOrderSend.vue +++ b/src/views/workOrder/workOrderSend.vue @@ -2317,6 +2317,7 @@ activated() { window.addEventListener('resize', this.getHeight) this.getHeight() + this.handleRequest() }, created() { this.handleRequest() diff --git a/vue.config.js b/vue.config.js index 959ea30..29d9323 100644 --- a/vue.config.js +++ b/vue.config.js @@ -52,8 +52,8 @@ }, proxy: { [process.env.VUE_APP_BASE_API]: { - target: 'http://121.196.36.24:8035', // 鏈湴 - // target: 'http://192.168.2.138:8002', // 鍢夋寔鐢靛櫒 + // target: 'http://121.196.36.24:8035', // 鏈湴 + target: 'http://192.168.2.138:8002', // 鍢夋寔鐢靛櫒 changeOrigin: true, // 璇锋眰璺ㄥ煙鏃讹紝闇� 閰嶇疆姝ら」 pathRewrite: { // 璺緞閲嶅啓,鏇挎崲target涓殑璇锋眰鍦板潃 ['^' + process.env.VUE_APP_BASE_API]: '/api/' -- Gitblit v1.9.3