From bcb82edd902b2e45c8da004cbf86e203ea496fa8 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 23 四月 2024 15:02:23 +0800 Subject: [PATCH] 机台管理模块 修改员工为下拉搜索的交互样式+列表联调+添加机台联调+编辑机台联调+ --- src/views/employeeSalary/machineManage/index.vue | 134 +++++++++++++++++++++++++++++++++----------- 1 files changed, 100 insertions(+), 34 deletions(-) diff --git a/src/views/employeeSalary/machineManage/index.vue b/src/views/employeeSalary/machineManage/index.vue index 69fc85b..f3099c5 100644 --- a/src/views/employeeSalary/machineManage/index.vue +++ b/src/views/employeeSalary/machineManage/index.vue @@ -4,8 +4,7 @@ <CommonSearch ref="searchRef" :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch"> <template slot="leftButton"> <el-button size="small" type="primary" @click="addBtnClick" >鏂板</el-button> - <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button> - <el-button size="small" type="primary" @click="printClick">鎵撳嵃</el-button> + <!-- <el-button size="small" type="primary" @click="exportClick">瀵煎叆</el-button> --> </template> </CommonSearch> </div> @@ -14,15 +13,13 @@ <TableCommonView :table-list="tableList" @selTableCol="selTableCol" - @handleShow="handleShow" @tableRowClick="tableRowClick" > <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="180"> + <el-table-column label="鎿嶄綔" width="160" fixed='right'> <template slot-scope="scope"> - <el-button @click.stop="handleClick(scope.row, '鏌ョ湅')" type="text" size="small">鏌ョ湅</el-button> <el-button @click.stop="handleClick(scope.row, '淇敼')" type="text" size="small">淇敼</el-button> - <el-button @click.stop="handleClick(scope.row, '鍒犻櫎')" type="text" size="small">鍒犻櫎</el-button> + <el-button @click.stop="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button> </template> </el-table-column> @@ -30,7 +27,8 @@ </TableCommonView> </div> <AddDialog - :editDiaConfig="editConfig" + ref="add" + :editRow="editRow" @refresh="refreshClick" /> <div class="btn-pager"> <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> @@ -40,8 +38,11 @@ </template> <script> +import { getWorkerPositionList, deleteWorkerPositionInfo } from "@/api/employeeSalary/machineManage.js" import AddDialog from "@/views/employeeSalary/machineManage/components/addDialog.vue" import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import Date from "@/api/date"; +const { formatDate2 } = Date; export default { name: "machineManage", props: {}, @@ -51,23 +52,20 @@ data() { return { tableList: {}, - showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鍗婅溅鏍囧織", "澶囨敞"], + showCol: ["鏃ユ湡", "宸ョ", "鍛樺伐缂栫爜", "鍛樺伐濮撳悕", "杞﹂棿", "缁勫埆", "鏈哄彴鍙�", "娣诲姞鏃堕棿", "娣诲姞浜�"], tableColumn: [ - // { label: "杞﹂棿", prop: "workshopNumber",iconRight:"el-icon-setting"}, - { label: "杞﹂棿", prop: "workshopNumber",}, - { label: "缁勫埆", prop: "groupNumber", }, - { label: "寮�濮嬭溅鍙�", prop: "startCarNumber" }, - { label: "缁撴潫杞﹀彿", prop: "endCarNumber" }, - { label: "鍗婅溅鏍囧織", prop: "carFlag",isCallMethod: true, getCallMethod: this.getStatusCarFlag }, - { label: "澶囨敞", prop: "notes", }, + { label: "鏃ユ湡", prop: "date",min:180}, + { label: "宸ョ", prop: "workType",min:110 }, + { label: "鍛樺伐缂栫爜", prop: "workerId",min:110 }, + { label: "鍛樺伐濮撳悕", prop: "name",min:110 }, + { label: "杞﹂棿", prop: "workshopName",min:110 }, + { label: "缁勫埆", prop: "workshopGroup",min:110 }, + { label: "鏈哄彴鍙�", prop: "workerPosition",min:110 }, + { label: "娣诲姞鏃堕棿", prop: "created_at",min:120 }, + { label: "娣诲姞浜�", prop: "creator",min:110 }, ], - editConfig:{ - visible:false, - infomitton:{ - TabsIndex:0, - workshopId:null, - } - }, + editRow:{}, + loading: false, getDataParams: { keyWord: '', }, @@ -75,6 +73,7 @@ }, created() { this.setTable() + this.getData(this.getDataParams.keyWord) }, methods: { setTable() { @@ -109,30 +108,97 @@ this.showcol = val this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn) }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + await getWorkerPositionList({ + keyword:this.getDataParams.keyWord, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }) + .then((res) => { + if (res.code === 200) { + if (res.data) { + const list = res.data.map(item=>{ + return { + ...item, + date:item.StartDate?item.StartDate+'/'+item.EndDate:'', + workType:item.worker?item.worker.workType:'', + name:item.worker?item.worker.name:'', + workerPosition:item.startWorkerPosition?item.startWorkerPosition+'-'+item.endWorkerPosition:'', + created_at:item.CreatedAt?formatDate2(item.CreatedAt).split(' ')[0]:'' + } + }) + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.total + } else { + this.tableList.tableInfomation = [] + } + } else { + this.tableList.tableInfomation = [] + } + this.loading = false + }) + .catch((err) => { + console.log(err) + this.tableList.tableInfomation = [] + this.loading = false + }) + }, // 鏂板 addBtnClick() { - this.editConfig.infomitton={} - this.editConfig.dialogTitle="鏂板" - this.editConfig.visible=true + this.editRow = { title:'鏂板缓',type:'add' } + this.$refs.add.islook = true; }, // 鎼滅储 onFilterSearch(searchText) { this.getDataParams.keyWord = searchText, - this.getData() + this.pagerOptions.currPage = 1 + this.getData() }, // 鍒锋柊 refreshClick() { - this.getDataParams.keyWord = "" - this.pagerOptions.currPage = 1 - this.pagerOptions.pageSize = 15 - // this.$refs.searchRef.searchInput = "" this.getData() }, // 鎵撳嵃 - printClick() { }, - // 缁勫埆 - handleShow() { - + exportClick() { }, + // 缂栬緫 + handleClick(row) { + let config=JSON.parse(JSON.stringify(row)); + this.editRow = { + ...config, + title:'缂栬緫', + type:'edit', + id:config.ID, + date:config.StartDate?[config.StartDate,config.EndDate]:[], + workshopObj:{ + value:config.workshop, + label:config.workshopName, + }, + name:config.worker?config.worker.name:'', + workerPosition:{ + value:config.startWorkerPosition?config.startWorkerPosition+'-'+config.endWorkerPosition:'', + label:config.startWorkerPosition?config.startWorkerPosition+'-'+config.endWorkerPosition:'', + }, + } + this.$refs.add.islook = true; + }, + // 鍒犻櫎 + delClick(row) { + this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + deleteWorkerPositionInfo({ id: row.ID }).then((response) => { + if (response.code === 200) { + this.$message.success("鍒犻櫎鎴愬姛") + this.getData() + } + }) + }) + .catch(() => {}) }, // 琛ㄦ牸琛岀偣鍑� tableRowClick(row) { -- Gitblit v1.8.0