From 96aea12d4cbbda5d51fd8e85fdfb871c1f20a7fc Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期三, 10 四月 2024 11:30:17 +0800 Subject: [PATCH] 生丝定价,数据字典,车间管理接口联调 --- src/views/systemSetting/silkPriceStandard/index.vue | 237 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 143 insertions(+), 94 deletions(-) diff --git a/src/views/systemSetting/silkPriceStandard/index.vue b/src/views/systemSetting/silkPriceStandard/index.vue index 17559ac..d6957a9 100644 --- a/src/views/systemSetting/silkPriceStandard/index.vue +++ b/src/views/systemSetting/silkPriceStandard/index.vue @@ -1,150 +1,188 @@ <template> <div class="silkStandardSetting-container"> <div class="filter-card"> - <CommonSearch :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch"> + <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="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> - <SilkTableList - :detail-enter="isEdit" - :silk-table-list="silkTableList" - @inputContent="inputContent" - @addProjectClick="addBtnClick" - @clearupProject="clearupProject" - @deleteClick="clearupProject" - @addColumnClick="addColumnClick" - @clearupColumn="clearupColumn" + <div class="list-view"> + <TableCommonView + :table-list="tableList" + @selTableCol="selTableCol" + @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 class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> </div> + + <AddDialog + :editDiaConfig="editConfig" + /> </div> </template> <script> -import SilkTableList from "@/views/systemSetting/silkPriceStandard/components/silkTableList" +import AddDialog from "@/views/systemSetting/silkPriceStandard/components/addDialog" +import {getPriceStandardList,deletePriceStandard} from "@/api/systemSetting/silkPriceStandard" +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" export default { name: "silkPriceStandard", props: {}, - components: { SilkTableList }, - mixins: [], + components: { AddDialog }, + mixins: [pageMixin], 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: "price2", inputFloat: true }, + { label: "搴勫彛", prop: "marketNumber",}, + { label: "鐢熶笣绛夌骇", prop: "rawSilkGrade", }, + { label: "钖叕鏍囧噯", prop: "payStandard" }, + { label: "鍗曚綅", prop: "unit" }, + { label: "澶囨敞", prop: "notes", }, ], - columnNum: 0, - dataObj: { - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0 + editConfig:{ + visible:false, + infomitton:{ + + } + }, + getDataParams:{ + keyWord:"", + // page: this.pagerOptions.currPage, + // pageSize: this.pagerOptions.pageSize } } }, created() { - this.setTableForm() + this.setTable() + this.getData() }, methods: { - setTableForm() { - this.silkTableList = { - tableData: this.tableData, - isReturn: false, - tableColumn: this.tableColumn - } - }, // 鎼滅储 onFilterSearch(searchText) { - console.log(searchText) + this.getDataParams.keyWord = searchText + this.pagerOptions.currPage = 1 + 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.dialogTitle="鏂板" + this.editConfig.visible=true + this.editConfig.infomitton={} }, // 淇濆瓨 saveBtnClick(){ - this.tableData.forEach((item)=>{ - item.isAdd=false - }) - this.isEdit = false }, // 鍒锋柊 - refreshClick() {}, + refreshClick() { + this.getDataParams.keyWord = "" + this.pagerOptions.currPage = 1 + this.pagerOptions.pageSize = 15 + this.$refs.searchRef.searchInput="" + this.getData() + + }, // 鎵撳嵃 printClick() {}, // 鍒楄〃杈撳叆鍥炶皟 inputContent(val, prop, row) { console.log(val, prop, row,"鍒楄〃鎵撳嵃鍥炶皟") }, - // 鍒犻櫎 - clearupProject(data, index) { - console.log(data) - this.tableData.splice(index, 1) + setTable() { + // top 鏄庣粏鍗曞垪琛� + this.tableList = { + selectIndex: true, + tableInfomation: [], + allcol: [], + showcol: this.showCol, + tableColumn: this.setColumnVisible(this.showCol, this.tableColumn) + } + this.setTableList(this.tableList) }, - // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 - editSaveClick() { - this.isEdit = !this.isEdit - }, - // 娣诲姞鍒� - 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 - }, - // 鍒犻櫎鍒� - clearupColumn(prop) { - let currentIndex = 0 - this.tableColumn.map((item, index) => { - if (item.prop == prop) { - currentIndex = index + setColumnVisible(showCol, tableColumn) { + return tableColumn.map((ele) => { + return { + ...ele, + isShowColumn: showCol.includes(ele.label) } }) - this.tableColumn.splice(currentIndex, 1) - this.silkTableList.tableColumn = this.tableColumn - this.$delete(this.dataObj, prop) }, - // 鍒犻櫎 - delBtnClick(){ - + 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") + }, + async getData(){ + await getPriceStandardList({ + keyWord:this.getDataParams.keyWord, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }).then((res)=>{ + if(res&&res.code===200){ + this.tableList.tableInfomation=res.data + this.pagerOptions.totalCount = res.total + } + }) + }, + handleClick(row,type){ + if(type==="鏌ョ湅"){ + this.editConfig.infomitton=row + this.editConfig.dialogTitle=type + this.editConfig.visible=true + }else if(type==="淇敼"){ + this.editConfig.infomitton=row + this.editConfig.dialogTitle=type + this.editConfig.visible=true + }else if(type==="鍒犻櫎"){ + this.$confirm(`纭鍒犻櫎${row.name}鍚�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + deletePriceStandard({id:row.ID}).then((res)=>{ + if(res&&res.code===200){ + this.getData() + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + } + }) + }) + } + } } } </script> @@ -185,4 +223,15 @@ } } } +.list-view { + height: calc(100% - 60px); + overflow: hidden; +} +.btn-pager { + display: flex; + margin-top: 10px; + .page { + margin-left: auto; + } +} </style> -- Gitblit v1.8.0