From 4bf10a1ba42ddaeab565c105b376c5732b0f3dab Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 09 四月 2024 11:47:11 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/silk/silk-web --- src/views/systemSetting/workshopManage/index.vue | 260 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 164 insertions(+), 96 deletions(-) diff --git a/src/views/systemSetting/workshopManage/index.vue b/src/views/systemSetting/workshopManage/index.vue index e029789..2864e5a 100644 --- a/src/views/systemSetting/workshopManage/index.vue +++ b/src/views/systemSetting/workshopManage/index.vue @@ -4,150 +4,217 @@ <CommonSearch :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="delBtnClick" >鍒犻櫎</el-button> --> - <el-button size="small" type="primary" @click="saveBtnClick" >淇濆瓨</el-button> - | - <!-- <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> </template> </CommonSearch> </div> <div class="body-card"> - <!-- <div class="edit-save"> - <div class="edit-save-icon" @click="editSaveClick"> - <i :class="isEdit ? 'el-icon-unlock' : 'el-icon-lock'"></i> - </div> - <div class="edit-sace-label">{{ isEdit ? "閿佸畾淇濆瓨" : "鐣岄潰璁捐" }}</div> - </div> --> <div> - <SilkTableList - :detail-enter="isEdit" - :silk-table-list="silkTableList" - @inputContent="inputContent" - @addProjectClick="addBtnClick" - @clearupProject="clearupProject" - @deleteClick="clearupProject" - @addColumnClick="addColumnClick" - @clearupColumn="clearupColumn" + <TableCommonView + :table-list="tableList" + @selTableCol="selTableCol" + @handleShow="handleShow" + @tableRowClick="tableRowClick" > - </SilkTableList> + <template slot="tableButton"> + <el-table-column label="鎿嶄綔" width="180"> + <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> + + </template> + </el-table-column> + </template> + </TableCommonView> </div> </div> + <AddWorkshop + ref="bomTypeDialog" + @handleConfirmSave="handleConfirmSave" + :workList="workList" + title="娣诲姞鑺傜偣绫诲瀷" + /> + <AddDataDictionaries + :editDiaConfig="editConfig" + /> </div> </template> <script> -import SilkTableList from "@/views/systemSetting/workshopManage/components/silkTableList" +import AddDataDictionaries from "@/views/systemSetting/workshopManage/components/addDialog.vue" +import { getWorkshopManageList,deleteWorkshopManage } from "@/api/systemSetting/workshopManage" +import TableCommonView from '@/components/makepager/TableCommonView.vue' +import AddWorkshop from '@/views/systemSetting/workshopManage/components/addWorkshop.vue' export default { name: "workshopManage", props: {}, - components: { SilkTableList }, + components: { TableCommonView,AddWorkshop,AddDataDictionaries }, mixins: [], computed: {}, data() { return { - isEdit: false, - silkTableList: {}, - tableData: [], + tableList: {}, + showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鍗婅溅鏍囧織", "澶囨敞"], tableColumn: [ - { label: "杞﹂棿", prop: "projectName", projectName: true }, - { label: "缁勫埆", prop: "start", inputFloat: true }, - { label: "寮�濮嬭溅鍙�", prop: "end", inputFloat: true }, - { label: "缁撴潫杞﹀彿", prop: "price1", inputFloat: true }, - { label: "鍗婅溅鏍囧織", prop: "projectName", projectName: true }, - { label: "澶囨敞", prop: "price2", inputFloat: true }, + // { 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", }, ], - columnNum: 0, - dataObj: { - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0 - } + // 绫诲瀷 + workList: [], + getDataParams: { + page: 1, + pageSize: 10, + keyWord: '', + }, + editConfig:{ + visible:false, + infomitton:{ + TabsIndex:0, + workshopId:null, + } + }, } }, created() { - this.setTableForm() + this.setTable() + this.getData() }, methods: { - setTableForm() { - this.silkTableList = { - tableData: this.tableData, - isReturn: false, - tableColumn: this.tableColumn + setTable() { + console.log(this.tableColumn,"鐪嬬湅") + // top 鏄庣粏鍗曞垪琛� + this.tableList = { + selectIndex: true, + tableInfomation: [], + allcol: [], + showcol: this.showCol, + tableColumn: this.setColumnVisible(this.showCol, this.tableColumn) } + this.setTableList(this.tableList) + }, + setColumnVisible(showCol, tableColumn) { + return tableColumn.map((ele) => { + return { + ...ele, + isShowColumn: showCol.includes(ele.label) + } + }) + }, + setTableList(tableList) { + tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) + this.searchOptions = [] + for (let i = 0; i < tableList.tableColumn.length; i++) { + const label = tableList.tableColumn[i].label + const value = tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, + selTableCol(val) { + this.showcol = val + this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn) + }, + // 琛ㄦ牸琛岀偣鍑� + tableRowClick(row){ + console.log(row,"row") }, // 鎼滅储 onFilterSearch(searchText) { - console.log(searchText) + console.log(searchText,"鏄暐") + this.getDataParams.keyWord=searchText, + this.getData() }, // 鏂板 addBtnClick() { - if(this.isEdit){ - this.$message.warning("璇峰厛淇濆瓨褰撳墠缂栬緫") - }else{ - this.isEdit = true - // array.splice(index, 0, item) - this.tableData.splice(0,0,{ - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0, - isAdd:true, - }) - } - - + this.editConfig.infomitton=[] + this.editConfig.dialogTitle="鏂板" + this.editConfig.visible=true }, // 淇濆瓨 saveBtnClick(){ - this.tableData.forEach((item)=>{ - item.isAdd=false - }) - this.isEdit = false + }, // 鍒锋柊 refreshClick() {}, // 鎵撳嵃 printClick() {}, - // 鍒楄〃杈撳叆鍥炶皟 - inputContent(val, prop, row) { - console.log(val, prop, row,"鍒楄〃鎵撳嵃鍥炶皟") - }, // 鍒犻櫎 - clearupProject(data, index) { - console.log(data) - this.tableData.splice(index, 1) + delBtnClick(){}, + // 缁勫埆 + handleShow(item){ + console.log(item,"item") + this.$refs.bomTypeDialog.editDialogVisible = true; }, - // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 - editSaveClick() { - this.isEdit = !this.isEdit + handleGetBomKindDictList() { + // postGetBomKindDictList().then((res) => { + // this.workList = res.data; + // }); }, - // 娣诲姞鍒� - addColumnClick() { - let propStr = "trends" + this.columnNum - this.tableColumn.splice(2, 0, { label: "", prop: propStr, inputFloat: true, addColumn: true }) - this.$set(this.dataObj, propStr, 0) - console.log(this.tableColumn) - this.silkTableList.tableColumn = this.tableColumn - this.columnNum += 1 + handleConfirmSave(data) { + console.log(data,"data") + // postSaveBomKindDict({ data: data }).then((res) => { + // if (res.code == 200) { + // this.$message({ + // message: "鎿嶄綔鎴愬姛锛�", + // type: "success", + // }); + // this.$refs.bomTypeDialog.editDialogVisible = false; + // this.handleGetBomKindDictList(); + // } + // }); }, - // 鍒犻櫎鍒� - clearupColumn(prop) { - let currentIndex = 0 - this.tableColumn.map((item, index) => { - if (item.prop == prop) { - currentIndex = index - } + // 杞﹂棿鍒楄〃 + async getData() { + await getWorkshopManageList({ + keyWord: this.getDataParams.keyWord, + page: this.getDataParams.page, + pageSize: this.getDataParams.pageSize, + }).then((res) => { + this.tableList.tableInfomation = res.data }) - this.tableColumn.splice(currentIndex, 1) - this.silkTableList.tableColumn = this.tableColumn - this.$delete(this.dataObj, prop) + }, + getStatusCarFlag(val) { + if (val) { + return val == 1 ? '宸﹀崐杞�' : val == 2 ? '鍙冲崐杞�' : val == 3 ? '鍏ㄨ溅缁撴潫' : '--' + } else { + return "--"; + } + }, + handleClick(row,type){ + console.log(row,"row") + if(type==="鏌ョ湅"){ + this.editConfig.infomitton=row + this.editConfig.infomitton.workshopId=row.ID + this.editConfig.dialogTitle=type + this.editConfig.visible=true + }else if(type==="淇敼"){ + this.editConfig.infomitton=row + this.editConfig.infomitton.workshopId=row.ID + this.editConfig.dialogTitle=type + this.editConfig.visible=true + }else if(type==="鍒犻櫎"){ + this.$confirm(`纭鍒犻櫎${row.name}鍚�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + deleteWorkshopManage({id:row.ID}).then((res)=>{ + if(res&&res.code===200){ + this.getData() + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + } + }) + }) + } } } } @@ -190,3 +257,4 @@ } } </style> + -- Gitblit v1.8.0