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/dataDictionary/components/addDataDictionaries.vue | 172 ++++--- src/views/systemSetting/encodeManage/index.vue | 23 /dev/null | 402 ------------------ src/api/systemSetting/silkPriceStandard.js | 44 ++ src/api/systemSetting/dataDictionary.js | 19 src/views/systemSetting/dataDictionary/index.vue | 71 ++ src/views/systemSetting/silkPriceStandard/components/addDialog.vue | 197 ++++++++ src/views/systemSetting/workshopManage/components/addDialog.vue | 84 ++- src/api/systemSetting/workshopManage.js | 2 src/views/systemSetting/silkPriceStandard/index.vue | 237 ++++++---- src/views/systemSetting/workshopManage/index.vue | 47 + 11 files changed, 654 insertions(+), 644 deletions(-) diff --git a/src/api/systemSetting/dataDictionary.js b/src/api/systemSetting/dataDictionary.js index 1889e51..b6f7f61 100644 --- a/src/api/systemSetting/dataDictionary.js +++ b/src/api/systemSetting/dataDictionary.js @@ -3,7 +3,7 @@ // 瀛楀吀鍒楄〃 export function getDict(data) { return request({ - url: "/api-jl/v1/system/dict?dictType="+data.dictType, + url: "/api-jl/v1/system/dict?dictType="+data.dictType+"&keyword="+data.keyword+"&page="+data.page+"&pageSize="+data.pageSize, method: "get", data }) @@ -17,3 +17,20 @@ data }) } + +// 缂栬緫瀛楀吀 +export function editDict(data) { + return request({ + url: "/api-jl/v1/system/dict", + method: "put", + data + }) +} +// 鍒犻櫎瀛楀吀 +export function deleteDict(data) { + return request({ + url: "/api-jl/v1/system/dict/"+data.id, + method: "delete", + data + }) +} \ No newline at end of file diff --git a/src/api/systemSetting/silkPriceStandard.js b/src/api/systemSetting/silkPriceStandard.js new file mode 100644 index 0000000..ff24003 --- /dev/null +++ b/src/api/systemSetting/silkPriceStandard.js @@ -0,0 +1,44 @@ +import request from "@/common/untils/request.js" + +// 鐢熶笣瀹氫环鍒楄〃 +export function getPriceStandardList(data) { + return request({ + url: "/api-jl/v1/system/getPriceStandardList?page="+ data.page+"&pageSize="+data.pageSize+"&keyWord="+data.keyWord, + method: "get", + data + }) +} + +// 鐢熶笣绛夌骇鍒楄〃 +export function getRankStandardGrade(data) { + return request({ + url: "/api-jl/v1/system/getRankStandardGrade", + method: "get", + data + }) +} +// 瀛楀吀鍒楄〃 +export function getDict(data) { + return request({ + url: "/api-jl/v1/system/dict?dictType="+data.dictType, + method: "get", + data + }) +} +// 淇濆瓨鐢熶笣瀹氫环鏍囧噯 +export function savePriceStandard(data) { + return request({ + url: "/api-jl/v1/system/savePriceStandard", + method: "post", + data + }) +} +// 鍒犻櫎鐢熶笣瀹氫环鏍囧噯 + +export function deletePriceStandard(data) { + return request({ + url: "/api-jl/v1/system/deletePriceStandard/"+data.id, + method: "delete", + data + }) +} diff --git a/src/api/systemSetting/workshopManage.js b/src/api/systemSetting/workshopManage.js index 9a48a80..8faffae 100644 --- a/src/api/systemSetting/workshopManage.js +++ b/src/api/systemSetting/workshopManage.js @@ -3,7 +3,7 @@ // 杞﹂棿鍒楄〃 export function getWorkshopManageList(data) { return request({ - url: "/api-jl/v1/system/getWorkshopManageList"+'?keyWord='+data.keyWord, + url: "/api-jl/v1/system/getWorkshopManageList?page="+ data.page+"&pageSize="+data.pageSize+"&keyWord="+data.keyWord, method: "get", data }) diff --git a/src/views/systemSetting/dataDictionary/components/addDataDictionaries.vue b/src/views/systemSetting/dataDictionary/components/addDataDictionaries.vue index aac1404..507c6d1 100644 --- a/src/views/systemSetting/dataDictionary/components/addDataDictionaries.vue +++ b/src/views/systemSetting/dataDictionary/components/addDataDictionaries.vue @@ -1,76 +1,82 @@ <template> <div class="add_wordshop"> - <el-dialog - :title="editConfig.dialogTitle+editConfig.dialogTitleType" - :visible.sync="editConfig.visible" - width="30%" + <el-dialog :title="editConfig.dialogTitle + editConfig.dialogTitleType" :visible.sync="editConfig.visible" width="30%" :before-close="handleClose"> - <el-form :inline="true" label-width="20%" style="width: 100%;" :model="form" > - <template v-if="editConfig.infomitton.TabsIndex===0||editConfig.infomitton.TabsIndex===1"> - <el-form-item label="缂栫爜" style="width: 100%;" > - <el-input v-model="form.number" placeholder="璇疯緭鍏�"></el-input> + <el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules" + ref="ruleForm"> + <template v-if="editConfig.infomitton.TabsIndex === 0 || editConfig.infomitton.TabsIndex === 1"> + <el-form-item prop="number" label="缂栫爜" style="width: 100%;"> + <el-input :disabled="editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.number" + placeholder="璇疯緭鍏�"></el-input> </el-form-item> - <el-form-item label="鍚嶇О" style="width: 100%;" > - <el-input v-model="form.name" placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> + <el-form-item prop="name" label="鍚嶇О" style="width: 100%;"> + <el-input :disabled="editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.name" + placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> </el-form-item> </template> - <template v-if="editConfig.infomitton.TabsIndex===2"> - <el-form-item label="甯﹀彿棰滆壊" style="width: 100%;" > - <el-input v-model="form.name" placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> - </el-form-item> - </template> - - <template v-if="editConfig.infomitton.TabsIndex===3"> - <el-form-item label="瑙勬牸" style="width: 100%;" > - <el-input v-model="form.number" placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> + <template v-if="editConfig.infomitton.TabsIndex === 2"> + <el-form-item prop="name" label="甯﹀彿棰滆壊" style="width: 100%;"> + <el-input :disabled="editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.name" + placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> </el-form-item> </template> - <el-form-item label="鎻忚堪" style="width: 100%;" > - <el-input - v-model="form.remark" - type="textarea" - :rows="4" - style="resize: none !important;" - placeholder="璇疯緭鍏�" - > + <template v-if="editConfig.infomitton.TabsIndex === 3"> + <el-form-item prop="name" label="瑙勬牸" style="width: 100%;"> + <el-input :disabled="editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.name" + placeholder="璇疯緭鍏ュ瓧姣嶆垨鏁板瓧锛屼笉鍏佽鏈夌┖鏍笺�佷腑鏂�"></el-input> + </el-form-item> + </template> + + <el-form-item label="鎻忚堪" style="width: 100%;"> + <el-input :disabled="editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.remark" type="textarea" + :rows="4" style="resize: none !important;" placeholder="璇疯緭鍏�"> </el-input> </el-form-item> - + </el-form> - <span slot="footer" class="dialog-footer"> + <span slot="footer" class="dialog-footer" v-if="editConfig.dialogTitle != '鏌ョ湅'"> <el-button @click="editConfig.visible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="commitForm">纭� 瀹�</el-button> + <el-button type="primary" @click="commitForm('ruleForm')">纭� 瀹�</el-button> </span> </el-dialog> </div> </template> <script> -import {addDict} from "@/api/systemSetting/dataDictionary" +import { addDict, editDict } from "@/api/systemSetting/dataDictionary" export default { props: { - editDiaConfig:{ + editDiaConfig: { type: Object, default: () => { return { visible: false, - dialogTitle:"娣诲姞", + dialogTitle: "娣诲姞", infomitton: { - } } } } }, data() { + const checkSpace = (rule, value, callback) => { + if (value.includes(' ')) { + callback(new Error('鍚嶇О涓嶈兘鍖呭惈绌烘牸')); + } else { + callback(); + } + }; return { - editConfig:this.editDiaConfig, - form: { - name: '', - number: '', - remark:"" + editConfig: this.editDiaConfig, + rules: { + number: [ + { required: true, message: '璇峰~鍐欑紪鐮�', trigger: 'change' } + ], + name: [ + {validator: checkSpace, required: true, message: '璇峰~鍐欏悕绉板苟涓斾笉鑳芥湁绌烘牸', trigger: 'change' } + ] } }; }, @@ -89,49 +95,63 @@ handleClose(done) { done(); }, - saveParams(type){ - let params={} - if(type===0||type===1){ - params={ - dictType:this.editConfig.infomitton.TabsIndex, - name: this.form.name, - number: this.form.number, - remark:this.form.remark, + saveParams(type) { + let params = {} + if (type === 0 || type === 1) { + params = { + dictType: this.editConfig.infomitton.TabsIndex, + name: this.editConfig.infomitton.name, + number: this.editConfig.infomitton.number, + remark: this.editConfig.infomitton.remark, } - }else if(type===2){ - params={ - dictType:this.editConfig.infomitton.TabsIndex, - name: this.form.name, - number: this.form.number, - remark:this.form.remark, + } else if (type === 2) { + params = { + dictType: this.editConfig.infomitton.TabsIndex, + name: this.editConfig.infomitton.name, + remark: this.editConfig.infomitton.remark, } - }else if(type===3){ - params={ - dictType:this.editConfig.infomitton.TabsIndex, - name: this.form.name, - number: this.form.number, - remark:this.form.remark, + } else if (type === 3) { + params = { + dictType: this.editConfig.infomitton.TabsIndex, + name: this.editConfig.infomitton.name, + remark: this.editConfig.infomitton.remark, } } return params }, - commitForm(){ - let params=this.saveParams(this.editConfig.infomitton.TabsIndex) - if(this.editConfig.dialogTitle==="鏂板"){ - addDict(params).then((res)=>{ - if(res&&res.code===200){ - this.editConfig.visible=false - this.$parent.getData() - this.$message({ - message: `鏂板${this.editConfig.dialogTitleType}鎴愬姛!`, - type: 'success' - }); + commitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + let params = this.saveParams(this.editConfig.infomitton.TabsIndex) + if (this.editConfig.dialogTitle === "鏂板") { + addDict(params).then((res) => { + if (res && res.code === 200) { + this.editConfig.visible = false + this.$parent.getData() + this.$message({ + message: `鏂板${this.editConfig.dialogTitleType}鎴愬姛!`, + type: 'success' + }); + } + }) + } else if (this.editConfig.dialogTitle === "淇敼") { + editDict({ ...params, id: this.editConfig.infomitton.ID }).then((res) => { + if (res && res.code === 200) { + this.editConfig.visible = false + this.$parent.getData() + this.$message({ + message: `淇敼${this.editConfig.dialogTitleType}鎴愬姛!`, + type: 'success' + }); + } + }) } - console.log(res,"res") - }) - }else if(this.editConfig.dialogTitle==="淇敼"){ - console.log("淇敼") - } + } else { + console.log('error submit!!'); + return false; + } + }); + } }, components: { @@ -141,7 +161,7 @@ </script> <style scoped lang="scss"> -::v-deep .el-form-item__content{ +::v-deep .el-form-item__content { width: 70% !important; } </style> diff --git a/src/views/systemSetting/dataDictionary/index.vue b/src/views/systemSetting/dataDictionary/index.vue index 4c7b83e..9c1b9da 100644 --- a/src/views/systemSetting/dataDictionary/index.vue +++ b/src/views/systemSetting/dataDictionary/index.vue @@ -1,7 +1,7 @@ <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="refreshClick">鍒锋柊</el-button> @@ -9,7 +9,7 @@ </CommonSearch> </div> <div class="body-card"> - <div> + <div class="list-view"> <div class="bottom-tabs" > <div class="tab-pane" @click="getTab(0)" :style="{ background: TabsIndex == 0 ? '#2a78fb' : '#F1F3F8', @@ -36,7 +36,7 @@ 瑙勬牸 </div> </div> - <div class="list-view"> + <div > <TableCommonView :loading="loading" :table-list="productTableList" @selTableCol="selBottomTableCol"> <template slot="tableButton"> <el-table-column label="鎿嶄綔" width="160" fixed="right"> @@ -51,6 +51,9 @@ </TableCommonView> </div> </div> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> </div> <AddDataDictionaries :editDiaConfig="editConfig" @@ -60,12 +63,13 @@ <script> import AddDataDictionaries from "@/views/systemSetting/dataDictionary/components/addDataDictionaries.vue" -import {getDict} from "@/api/systemSetting/dataDictionary" +import {getDict,deleteDict} from "@/api/systemSetting/dataDictionary" +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" export default { name: "dataDictionary", props: {}, components: {AddDataDictionaries}, - mixins: [], + mixins: [pageMixin], computed: {}, data() { return { @@ -92,12 +96,12 @@ ], showWorkshopCol: ["缂栫爜","杞﹂棿鍚嶇О", "鎻忚堪",], colorTableColumn:[ - { label: "甯﹀彿棰滆壊", prop: "member_name" }, + { label: "甯﹀彿棰滆壊", prop: "name" }, { label: "鎻忚堪", prop: "remark" }, ], showColorCol: ["甯﹀彿棰滆壊", "鎻忚堪",], specsTableColumn:[ - { label: "瑙勬牸", prop: "member_name" }, + { label: "瑙勬牸", prop: "name" }, { label: "鎻忚堪", prop: "remark" }, ], showSpecsCol: ["瑙勬牸", "鎻忚堪",], @@ -105,6 +109,7 @@ page: 1, pageSize:10, dictType:0, + keyword:"" }, } }, @@ -116,16 +121,24 @@ methods: { // 鎼滅储 onFilterSearch(searchText) { - console.log(searchText) + this.getDataParams.keyword=searchText, + this.getData() }, // 鏂板 addBtnClick() { this.editConfig.dialogTitle="鏂板" + this.editConfig.infomitton={} + this.editConfig.infomitton.TabsIndex=this.TabsIndex this.editConfig.visible=true }, // 鍒锋柊 refreshClick() { - console.log("a") + this.getDataParams.keyword = "" + this.pagerOptions.currPage = 1 + this.pagerOptions.pageSize = 15 + this.$refs.searchRef.searchInput="" + this.TabsIndex=0, + this.getData() }, // 鎵撳嵃 printClick() { @@ -225,22 +238,39 @@ getData(){ getDict({ dictType:this.TabsIndex, - page:this.getDataParams.page, - pageSize:this.getDataParams.pageSize, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize, + keyword:this.getDataParams.keyword, }).then((res)=>{ - console.log(res,"res") this.productTableList.tableInfomation=res.data + this.pagerOptions.totalCount = res.total }) }, rowClick(row,type){ if(type==="鏌ョ湅"){ this.editConfig.dialogTitle="鏌ョ湅" this.editConfig.visible=true + this.editConfig.infomitton={...row,TabsIndex:this.TabsIndex} }else if(type==="淇敼"){ this.editConfig.dialogTitle="淇敼" this.editConfig.visible=true + this.editConfig.infomitton={...row,TabsIndex:this.TabsIndex} }else if(type==="鍒犻櫎"){ - console.log("鍒犻櫎") + this.$confirm('纭鍒犻櫎鍚�?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + deleteDict({id:row.ID}).then((res)=>{ + if(res&&res.code===200){ + this.getData() + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + } + }) + }) } } } @@ -313,4 +343,17 @@ .bgcWhite { background: #fff !important; -}</style> +} + +.list-view { + height: calc(100% - 60px); + overflow: hidden; +} +.btn-pager { + display: flex; + margin-top: 10px; + .page { + margin-left: auto; + } +} +</style> diff --git a/src/views/systemSetting/encodeManage/index.vue b/src/views/systemSetting/encodeManage/index.vue index b069a09..548b941 100644 --- a/src/views/systemSetting/encodeManage/index.vue +++ b/src/views/systemSetting/encodeManage/index.vue @@ -4,7 +4,7 @@ <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" >鍒犻櫎</el-button> <el-button size="small" type="primary" @click="addBtnClick" >淇敼</el-button> <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button> </template> @@ -17,7 +17,7 @@ </div> <div class="edit-sace-label">{{ isEdit ? "閿佸畾淇濆瓨" : "鐣岄潰璁捐" }}</div> </div> --> - <div> + <div class="list-view"> <SilkTableList :detail-enter="isEdit" :silk-table-list="silkTableList" @@ -30,17 +30,21 @@ > </SilkTableList> </div> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> </div> </div> </template> <script> import SilkTableList from "@/views/systemSetting/workshopManage/components/silkTableList" +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" export default { name: "encodeManage", props: {}, components: { SilkTableList }, - mixins: [], + mixins: [pageMixin], computed: {}, data() { return { @@ -115,7 +119,6 @@ }, // 鍒犻櫎 clearupProject(data, index) { - console.log(data) this.tableData.splice(index, 1) }, // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 @@ -127,7 +130,6 @@ 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 }, @@ -183,4 +185,15 @@ } } } +.list-view { + height: calc(100% - 60px); + overflow: hidden; +} +.btn-pager { + display: flex; + margin-top: 10px; + .page { + margin-left: auto; + } +} </style> diff --git a/src/views/systemSetting/silkPriceStandard/components/addDialog.vue b/src/views/systemSetting/silkPriceStandard/components/addDialog.vue new file mode 100644 index 0000000..0f76dbd --- /dev/null +++ b/src/views/systemSetting/silkPriceStandard/components/addDialog.vue @@ -0,0 +1,197 @@ +<template> + <div class="add_wordshop"> + <el-dialog :title="editConfig.dialogTitle + '鐢熶笣瀹氫环鏍囧噯'" :visible.sync="editConfig.visible" width="30%" + :before-close="handleClose"> + <el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules" + ref="ruleForm"> + <el-form-item prop="marketNumber" label="搴勫彛" style="width: 100%;"> + <el-select :disabled="this.editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.marketNumber" + placeholder="璇烽�夋嫨搴勫彛"> + <el-option v-for="item in shanguchiList" :key="item.ID" :label="item.name" :value="item.ID"> + </el-option> + </el-select> + </el-form-item> + <el-form-item prop="rawSilkGrade" label="鐢熶笣绛夌骇" style="width: 100%;"> + <el-select :disabled="this.editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.rawSilkGrade" + placeholder="璇烽�夋嫨鐢熶笣绛夌骇"> + <el-option v-for="item in classList" :key="item" :label="item" :value="item"> + </el-option> + </el-select> + </el-form-item> + <el-form-item prop="payStandard" label="钖叕鏍囧噯" style="width: 100%;"> + <!-- <el-input-number + v-model="form.workshopNumber" + placeholder="璇疯緭鍏ョ粍鍒�" + :controls="false" + style="width: 100%; margin-right: 5px;text-align:left;" + ></el-input-number> --> + <el-input :disabled="this.editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.payStandard" :rows="4" + style="resize: none !important;" placeholder="璇疯緭鍏ョ粍鍒�"> + </el-input> + </el-form-item> + <el-form-item label="鍗曚綅" style="width: 100%;"> + <el-input :disabled="this.editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.unit" :rows="4" + style="resize: none !important;" placeholder="璇疯緭鍏ョ粍鍒�"> + </el-input> + </el-form-item> + <el-form-item label="澶囨敞" style="width: 100%;"> + <el-input :disabled="this.editConfig.dialogTitle === '鏌ョ湅'" v-model="editConfig.infomitton.notes" type="textarea" + :rows="4" style="resize: none !important;" placeholder=""> + </el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="editConfig.visible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="commitForm('ruleForm')">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import { getDict, getRankStandardGrade, savePriceStandard } from "@/api/systemSetting/silkPriceStandard" +export default { + props: { + editDiaConfig: { + type: Object, + default: () => { + return { + visible: false, + dialogTitle: "娣诲姞", + isReadonly: true, + infomitton: { + }, + } + } + } + }, + data() { + return { + editConfig: this.editDiaConfig, + form: { + workshopNumber: null, + groupNumber: null, + startCarNumber: null, + endCarNumber: null, + carFlag: null, + notes: null + }, + shanguchiList: [], + carFlagList: [ + { id: 1, name: "宸﹀崐杞�" }, + { id: 2, name: "鍙冲崐杞�" }, + { id: 3, name: "鍏ㄨ溅缁撴潫" }, + ], + classList: [], + rules: { + marketNumber: [ + { required: true, message: '璇烽�夋嫨搴勫彛', trigger: 'change' } + ], + rawSilkGrade: [ + { required: true, message: '璇烽�夋嫨鐢熶笣绛夌骇', trigger: 'change' } + ], + payStandard: [ + { required: true, message: '璇烽�夋嫨鐢熶笣绛夌骇', trigger: 'change' } + ] + }, + }; + }, + computed: { + }, + created() { + this.getDictData() + this.getRankStandardGrade() + }, + mounted() { + + }, + watch: { + + }, + methods: { + handleClose(done) { + done(); + }, + async getDictData() { + await getDict({ dictType: 0 }).then((res) => { + if (res && res.code === 200) { + this.shanguchiList = res.data + } + }) + }, + setParams() { + let params = { + marketNumber: this.editConfig.infomitton.marketNumber + '', + unit: this.editConfig.infomitton.unit, + payStandard: Number(this.editConfig.infomitton.payStandard), + rawSilkGrade: this.editConfig.infomitton.rawSilkGrade, + notes: this.editConfig.infomitton.notes, + // id:Number(this.editConfig.infomitton.workshopId), + } + return params + }, + async commitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + let params = this.setParams() + if (this.editConfig.dialogTitle === "鏂板") { + savePriceStandard(params).then((res) => { + if (res && res.code === 200) { + this.editConfig.visible = false + this.$message({ + message: "淇濆瓨鎴愬姛!", + type: "success", + }); + this.$parent.getData() + } + }) + } else if (this.editConfig.dialogTitle === "淇敼") { + this.editConfig.infomitton.workshopNumber = this.editConfig.infomitton.workshopNumber + "" + savePriceStandard(this.editConfig.infomitton).then((res) => { + if (res && res.code === 200) { + this.editConfig.visible = false + this.$message({ + message: "淇濆瓨鎴愬姛!", + type: "success", + }); + this.$parent.getData() + } + }) + } + } else { + console.log('error submit!!'); + return false; + } + }); + }, + async getRankStandardGrade() { + await getRankStandardGrade().then((res) => { + if (res && res.data) { + this.classList = res.data + } + }) + } + }, + components: { + + }, +}; +</script> + +<style scoped lang="scss"> +::v-deep .el-form-item__content { + width: 70% !important; +} + +::v-deep { + .el-form { + .el-input__inner { + text-align: left; + } + } + + .el-select { + width: 100%; + } +} +</style> diff --git a/src/views/systemSetting/silkPriceStandard/components/silkTableList.vue b/src/views/systemSetting/silkPriceStandard/components/silkTableList.vue deleted file mode 100644 index baa5c52..0000000 --- a/src/views/systemSetting/silkPriceStandard/components/silkTableList.vue +++ /dev/null @@ -1,402 +0,0 @@ -<template> - <div class="page-view"> - <div class="top-box"> - <div class="table-box" :style="{ width: detailEnter ? '95%' : '100%' }"> - <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> - <el-table - ref="fromTable" - :data="tableList.tableData" - style="width: 100%" - @selection-change="handleSelectionChange" - :row-key="(row) => row.productId" - :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }" - border - > - <el-table-column v-if="selectBox" type="selection" :reserve-selection="true" width="40" align="center"> - </el-table-column> - <el-table-column - v-if="tableList.isReturn" - type="index" - label="#" - width="50" - align="center" - ></el-table-column> - <el-table-column - v-for="(item, i) in tableList.tableColumn" - :key="i" - :prop="item.prop" - :label="item.label" - :width="item.width" - :min-width="item.min" - align="center" - > - <!-- 琛ㄥご鏍峰紡 --> - <template slot="header"> - <span v-if="item.isRequird" style="color: #f56c6c">*</span> - <div v-else-if="item.addColumn" class="add-column-box"> - <el-input - placeholder="璇疯緭鍏�" - v-model="item.label" - size="mini" - clearable - @change=" - (val) => { - addColumnInputChange(val, item.prop) - } - " - ></el-input> - <div class="common-select-btn" @click="clearupColumn(item.prop)"> - <i class="el-icon-remove" title="鍒犻櫎"></i> - </div> - </div> - <span v-else>{{ item.label }}</span> - </template> - <!-- column鏍峰紡 --> - <template slot-scope="scope"> - <template v-if="scope.row.isAdd"> - <el-form-item - v-if="item.input" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <el-input - v-model.trim="scope.row[item.prop]" - maxlength="50" - size="mini" - :disabled="!isOperate" - @change=" - (val) => { - commonInputChange(val, item.prop, scope.row, scope) - } - " - ></el-input> - </el-form-item> - <el-form-item - v-else-if="item.projectName" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - > - <div class="custom-name"> - <el-select v-model="scope.row[item.prop]" clearable size="mini" placeholder="璇烽�夋嫨"> - <el-option - v-for="(item, index) in projectOptions" - :key="index" - :label="item.value" - :value="item.value" - > - </el-option> - </el-select> - <div class="common-select-btn" @click="clearupClient(scope)"> - <i class="el-icon-remove" title="鍒犻櫎"></i> - </div> - </div> - </el-form-item> - <el-form-item - v-else-if="item.inputNumber" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <el-input-number - v-model="scope.row[item.prop]" - placeholder="" - :min="0" - :controls="false" - :disabled="!isOperate" - size="mini" - style="width: 100%; margin-right: 5px" - @change=" - (val) => { - commonInputChange(val, item.prop, scope.row, scope) - } - " - ></el-input-number> - </el-form-item> - <el-form-item - v-else-if="item.inputFloat" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <el-input-number - v-model="scope.row[item.prop]" - placeholder="" - :min="0" - :precision="4" - :disabled="!isOperate" - :controls="false" - size="mini" - style="width: 100%; margin-right: 5px" - @change=" - (val) => { - commonInputChange(val, item.prop, scope.row, scope) - } - " - ></el-input-number> - </el-form-item> - <span v-else> - <template> - {{ scope.row[item.prop] }} - </template> - </span> - </template> - <el-form-item - v-else-if="item.inputNumber && selectBox" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <el-input-number - v-model="scope.row[item.prop]" - placeholder="" - :min="0" - :controls="false" - :disabled="!isOperate" - size="mini" - style="width: 100%; margin-right: 5px" - @change=" - (val) => { - commonInputChange(val, item.prop, scope.row, scope) - } - " - ></el-input-number> - </el-form-item> - <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" width="80" v-if="!detailEnter" align="center"> - <template slot-scope="scope"> - <el-button type="text" size="small" :disabled="!isOperate" @click="deleteClick(scope)">鍒犻櫎</el-button> - </template> - </el-table-column> - <slot name="tableButton" /> - <div slot="empty"> - <el-empty description="鏆傛棤鏁版嵁"></el-empty> - </div> - </el-table> - </el-form> - </div> - <!-- <div - v-if="detailEnter" - class="add-column-box" - @click="addColumnClick" - :style="{ width: detailEnter ? '40px' : '0px' }" - > - <i class="el-icon-circle-plus"></i> - </div> --> - </div> - <div v-if="detailEnter" style="margin: 10px"> - <div class="add-btn-box" @click="addRowClick"> - <i class="el-icon-circle-plus"></i> - </div> - <!-- <el-button size="small" type="primary" :disabled="!isOperate" @click="add">鏂板</el-button> --> - <!-- <el-button size="small" type="primary" disabled>瀵煎叆鏄庣粏</el-button> --> - </div> - </div> -</template> - -<script> -// import { getProductList } from "@/api/common/other" -export default { - name: "CommmonFormTableView", - components: {}, - props: { - detailEnter: { - type: Boolean, - default: false - }, - selectBox: { - type: Boolean, - default: false - }, - // 閭d釜椤甸潰 鐢ㄦ潵鍒ゆ柇璁$畻鏂瑰紡 - pageName: { - type: String, - default: "" - }, - // 鍒楄〃鏂板鏄惁澶氶�� - addTypeIdMultiple: { - type: Boolean, - default: false - }, - // 鏍规嵁鎶ヤ环鍗曟煡璇骇鍝� - quotationNumber: { - type: [String, Number], - default: "" - }, - // 鏄惁鍙互鎿嶄綔 娣诲姞绛� - isOperate: { - type: Boolean, - default: true - }, - silkTableList: { - type: Object, - default: () => { - return { - tableData: [], // 鎺ュ彛杩斿洖鏁版嵁 - isReturn: false, - tableColumn: [ - // table琛ㄥ崟 - { label: "", prop: "", min: 200, tooltip: true } - ] - } - } - } - }, - data() { - return { - total: 0, - productList: [], - tableList: [], - projectIndex: 0, - projectOptions: [ - { id: 1, value: "绾ゅ害鍋忓樊" }, - { id: 2, value: "浜屾鍙樺寲" }, - { id: 3, value: "娓呮磥鍒�" }, - { id: 4, value: "娲佸噣鍒�" }, - { id: 5, value: "鏈�澶у亸宸�" } - ] - } - }, - created() { - // if (!this.selectBox) { - // this.getProductList() - // } - this.getTableInfo() - }, - watch: { - silkTableList: { - handler() { - this.getTableInfo() - }, - immediate: true - } - }, - computed: {}, - methods: { - getTableInfo() { - this.tableList = this.silkTableList - if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") { - this.isRecalculate = false - } else { - this.isRecalculate = true - } - }, - // 澶氶�� - handleSelectionChange(val) { - this.$emit("getSelectArray", val) - }, - - // 鏂板 - addRowClick() { - if (this.addTypeIdMultiple) { - this.projectIndex = this.tableList.tableData.length - this.editSelCommonConfig.title = "浜у搧鍚嶇О" - this.editSelCommonConfig.isSelectBox = true - this.editSelCommonConfig.editVisible = true - } else { - this.$emit("addProjectClick") - } - }, - commonInputChange(val, prop, row, scope) { - this.$emit("inputContent", val, prop, row, scope) - }, - // 鍒犻櫎 - deleteClick(scope) { - this.$emit("clearupProject", this.tableList.tableData, scope.$index) - }, - // 鍒犻櫎 - clearupClient(scope) { - this.$emit("clearupProject", this.tableList.tableData, scope.$index) - }, - // 娣诲姞鍒楁寜閽� - addColumnClick() { - this.$emit("addColumnClick") - }, - // 娣诲姞鍒楀ご閮ㄦ爣棰樿緭鍏� - addColumnInputChange(val, prop) { - console.log(val, prop, "娣诲姞鍒楀ご閮ㄦ爣棰樿緭鍏�") - }, - // 鍒犻櫎鍒� - clearupColumn(prop) { - console.log(prop) - this.$emit("clearupColumn", prop) - } - }, - //瑙e喅琛ㄦ牸鎶栧姩闂 - beforeUpdate() { - this.$nextTick(() => { - this.$refs["fromTable"].doLayout() - }) - } -} -</script> - -<!-- Add "scoped" attribute to limit CSS to this component only --> -<style lang="scss" scoped> -.page-view { - .top-box { - display: flex; - .table-box { - flex: 1; - .el-form-item { - margin-bottom: 0; - .custom-name { - display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; - cursor: pointer; - color: #ff0000; - } - } - } - } - .add-column-box { - // width: 40px; - margin-top: 10px; - font-size: 26px; - color: #5582f3; - margin-left: 20px; - cursor: pointer; - } - } - .add-btn-box { - font-size: 26px; - color: #5582f3; - margin-left: 50px; - cursor: pointer; - } - .add-column-box { - display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; - cursor: pointer; - color: #ff0000; - } - } -} -::v-deep { - .el-form-item__label { - display: none; - } - .el-table__footer-wrapper tbody td.el-table__cell { - background-color: #fff; - // text-align: right; - font-weight: bold; - } - .el-input--suffix .el-input__inner { - padding-right: 0px; - } - .el-table .cell, - .el-table th.el-table__cell > .cell { - padding: 0 5px; - } - .el-input__inner { - // text-align: left; - text-align: center !important; - } -} -</style> 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> diff --git a/src/views/systemSetting/workshopManage/components/addDialog.vue b/src/views/systemSetting/workshopManage/components/addDialog.vue index c88406a..06bebec 100644 --- a/src/views/systemSetting/workshopManage/components/addDialog.vue +++ b/src/views/systemSetting/workshopManage/components/addDialog.vue @@ -5,8 +5,8 @@ :visible.sync="editConfig.visible" width="30%" :before-close="handleClose"> - <el-form :inline="true" label-width="20%" style="width: 100%;" :model="form" > - <el-form-item label="杞﹂棿" style="width: 100%;" > + <el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules" ref="ruleForm" > + <el-form-item prop="workshopNumber" label="杞﹂棿" style="width: 100%;" > <el-select :disabled="this.editConfig.dialogTitle==='鏌ョ湅'" v-model="editConfig.infomitton.workshopNumber" placeholder="璇烽�夋嫨杞﹂棿"> <el-option @@ -18,7 +18,8 @@ </el-select> </el-form-item> - <el-form-item label="缁勫埆" style="width: 100%;" > + <el-form-item label="缁勫埆" style="width: 100%;" + prop="groupNumber" > <!-- <el-input-number v-model="form.workshopNumber" placeholder="璇疯緭鍏ョ粍鍒�" @@ -80,7 +81,7 @@ </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="editConfig.visible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="commitForm">纭� 瀹�</el-button> + <el-button type="primary" @click="commitForm('ruleForm')">纭� 瀹�</el-button> </span> </el-dialog> </div> @@ -98,12 +99,6 @@ dialogTitle:"娣诲姞", isReadonly:true, infomitton: { - workshopNumber:null, - groupNumber:null, - startCarNumber:null, - endCarNumber:null, - carFlag:null, - notes:null }, } } @@ -125,7 +120,15 @@ {id:1,name:"宸﹀崐杞�"}, {id:2,name:"鍙冲崐杞�"}, {id:3,name:"鍏ㄨ溅缁撴潫"}, - ] + ], + rules: { + workshopNumber: [ + { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' } + ], + groupNumber: [ + { required: true, message: '璇峰~鍐欑粍鍒�', trigger: 'change' } + ] + }, }; }, computed: { @@ -162,32 +165,41 @@ } return params }, - async commitForm(){ - let params=this.setParams() - if(this.editConfig.dialogTitle==="鏂板"){ - await saveWorkshopManage(params).then((res)=>{ - if(res&&res.code===200){ - this.editConfig.visible=false - this.$message({ - message: "淇濆瓨鎴愬姛!", - type: "success", - }); - this.$parent.getData() + async commitForm(formName){ + this.$refs[formName].validate((valid) => { + if (valid) { + let params=this.setParams() + if(this.editConfig.dialogTitle==="鏂板"){ + saveWorkshopManage(params).then((res)=>{ + if(res&&res.code===200){ + this.editConfig.visible=false + this.$message({ + message: "淇濆瓨鎴愬姛!", + type: "success", + }); + this.$parent.getData() + } + }) + }else if(this.editConfig.dialogTitle==="淇敼"){ + this.editConfig.infomitton.workshopNumber=this.editConfig.infomitton.workshopNumber+"" + saveWorkshopManage(this.editConfig.infomitton).then((res)=>{ + if(res&&res.code===200){ + this.editConfig.visible=false + this.$message({ + message: "淇濆瓨鎴愬姛!", + type: "success", + }); + this.$parent.getData() + } + }) } - }) - }else if(this.editConfig.dialogTitle==="淇敼"){ - this.editConfig.infomitton.workshopNumber=this.editConfig.infomitton.workshopNumber+"" - await saveWorkshopManage(this.editConfig.infomitton).then((res)=>{ - if(res&&res.code===200){ - this.editConfig.visible=false - this.$message({ - message: "淇濆瓨鎴愬姛!", - type: "success", - }); - this.$parent.getData() - } - }) - } + } else { + console.log('error submit!!'); + return false; + } + }); + + } }, components: { diff --git a/src/views/systemSetting/workshopManage/index.vue b/src/views/systemSetting/workshopManage/index.vue index 2864e5a..80fd301 100644 --- a/src/views/systemSetting/workshopManage/index.vue +++ b/src/views/systemSetting/workshopManage/index.vue @@ -1,7 +1,7 @@ <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="refreshClick">鍒锋柊</el-button> @@ -10,7 +10,7 @@ </CommonSearch> </div> <div class="body-card"> - <div> + <div class="list-view"> <TableCommonView :table-list="tableList" @selTableCol="selTableCol" @@ -28,6 +28,9 @@ </el-table-column> </template> </TableCommonView> + </div> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> </div> <AddWorkshop @@ -47,11 +50,12 @@ import { getWorkshopManageList,deleteWorkshopManage } from "@/api/systemSetting/workshopManage" import TableCommonView from '@/components/makepager/TableCommonView.vue' import AddWorkshop from '@/views/systemSetting/workshopManage/components/addWorkshop.vue' +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" export default { name: "workshopManage", props: {}, components: { TableCommonView,AddWorkshop,AddDataDictionaries }, - mixins: [], + mixins: [pageMixin], computed: {}, data() { return { @@ -69,8 +73,6 @@ // 绫诲瀷 workList: [], getDataParams: { - page: 1, - pageSize: 10, keyWord: '', }, editConfig:{ @@ -88,7 +90,6 @@ }, methods: { setTable() { - console.log(this.tableColumn,"鐪嬬湅") // top 鏄庣粏鍗曞垪琛� this.tableList = { selectIndex: true, @@ -126,13 +127,12 @@ }, // 鎼滅储 onFilterSearch(searchText) { - console.log(searchText,"鏄暐") this.getDataParams.keyWord=searchText, this.getData() }, // 鏂板 addBtnClick() { - this.editConfig.infomitton=[] + this.editConfig.infomitton={} this.editConfig.dialogTitle="鏂板" this.editConfig.visible=true }, @@ -141,14 +141,19 @@ }, // 鍒锋柊 - refreshClick() {}, + refreshClick() { + this.getDataParams.keyWord = "" + this.pagerOptions.currPage = 1 + this.pagerOptions.pageSize = 15 + this.$refs.searchRef.searchInput="" + this.getData() + }, // 鎵撳嵃 printClick() {}, // 鍒犻櫎 delBtnClick(){}, // 缁勫埆 - handleShow(item){ - console.log(item,"item") + handleShow(){ this.$refs.bomTypeDialog.editDialogVisible = true; }, handleGetBomKindDictList() { @@ -157,7 +162,7 @@ // }); }, handleConfirmSave(data) { - console.log(data,"data") + console.log(data) // postSaveBomKindDict({ data: data }).then((res) => { // if (res.code == 200) { // this.$message({ @@ -173,10 +178,11 @@ async getData() { await getWorkshopManageList({ keyWord: this.getDataParams.keyWord, - page: this.getDataParams.page, - pageSize: this.getDataParams.pageSize, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize }).then((res) => { this.tableList.tableInfomation = res.data + this.pagerOptions.totalCount = res.total }) }, getStatusCarFlag(val) { @@ -187,10 +193,10 @@ } }, handleClick(row,type){ - console.log(row,"row") if(type==="鏌ョ湅"){ this.editConfig.infomitton=row this.editConfig.infomitton.workshopId=row.ID + this.editConfig.infomitton.workshopNumber=Number(this.editConfig.infomitton.workshopNumber) this.editConfig.dialogTitle=type this.editConfig.visible=true }else if(type==="淇敼"){ @@ -256,5 +262,16 @@ } } } +.list-view { + height: calc(100% - 60px); + overflow: hidden; +} +.btn-pager { + display: flex; + margin-top: 10px; + .page { + margin-left: auto; + } +} </style> -- Gitblit v1.8.0