From ef06a897369a84e4c1e3a9d5a8aeea5572d973bd Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 19 三月 2024 18:31:02 +0800 Subject: [PATCH] 生丝定级标准页面接口联调和添加列和列表数据输入的方法修改 --- src/views/systemSetting/silkStandardSetting/components/silkTableList.vue | 23 /dev/null | 104 -------- src/components/makepager/TableCommonView.vue | 327 +++++++++++++++--------- vue.config.js | 5 src/views/systemSetting/silkStandardSetting/index.vue | 184 ++++++++++++- src/api/systemSetting/silkStandardSetting.js | 17 + src/api/data.js | 65 ---- src/views/other/commonDialog/EditDropdownDialog.vue | 1 8 files changed, 404 insertions(+), 322 deletions(-) diff --git a/src/api/data.js b/src/api/data.js index be0d736..deb21f5 100644 --- a/src/api/data.js +++ b/src/api/data.js @@ -1,59 +1,14 @@ -// 閲囪喘鐘舵�� -const purchaseStatus=[ - { - name:'宸蹭笅鍗�', - id:1, - }, - { - name:'鍒拌揣璐ㄦ', - id:2, - }, - { - name:'宸插叆搴�', - id:3, - }, - { - name:'宸插畬鎴�', - id:4, - }, -] -// 璐ㄦ鍗曠姸鎬� -const qualityStatus=[ - { - name:'寰呰川妫�', - id:1, - }, - { - name:'宸插畬鎴�', - id:2, - } -] -// 閫�璐у崟鐘舵�� -const returnedStatus=[ - { - name:'寰呭彂璐�', - id:1, - }, - { - name:'寰呯鏀�', - id:2, - }, - { - name:'寰呭彂璐�', - id:3, - }, - { - name:'宸插畬鎴�', - id:4, - }, +// 妫�鏌ラ」鐩悕绉� +const projectOptions = [ + { id: 1, value: "绾ゅ害鍋忓樊" }, + { id: 2, value: "浜屾鍙樺寲" }, + { id: 3, value: "娓呮磥鍒�" }, + { id: 4, value: "娲佸噣鍒�" }, + { id: 5, value: "鏈�澶у亸宸�" } ] -export const getDataByType = type => { - if(type =='purchaseStatus'){ - return purchaseStatus; - }else if(type=='qualityStatus'){ - return qualityStatus; - }else if(type=='returnedStatus'){ - return returnedStatus; +export const getDataByType = (type) => { + if (type == "projectOptions") { + return projectOptions } } diff --git a/src/api/supplierManage/supplier.js b/src/api/supplierManage/supplier.js deleted file mode 100644 index 94cad95..0000000 --- a/src/api/supplierManage/supplier.js +++ /dev/null @@ -1,104 +0,0 @@ -import request from "@/common/untils/request.js" -import axios from "axios" - -// 鏈嶅姟鍟嗗垪琛� -export const getSupplierList = async (data) => { - return await axios.get(`/api/s/getSupplierList`, { - params: data - }) -} -// 鍒涘缓鏈嶅姟鍟� -export function createSupplier(data) { - return request({ - url: "/api/s/createSupplier", - method: "post", - data - }) -} -// 鍒犻櫎鏈嶅姟鍟� -export function deleteSupplier(data) { - return request({ - url: "/api/s/deleteSupplier", - method: "delete", - data - }) -} -// 鏇存柊鏈嶅姟鍟� -export function updateSupplier(data) { - return request({ - url: "/api/s/updateSupplier", - method: "put", - data - }) -} -// 淇敼鏈嶅姟鍟嗙姸鎬� -export function changeSupplierStatus(data) { - return request({ - url: "/api/s/changeSupplierStatus", - method: "post", - data - }) -} -// 鐢╥d鏌ヨ鏈嶅姟鍟� -export const findSupplier = async (data) => { - return await axios.get(`/api/s/findSupplier`, { - params: data - }) -} - -// 鏇存柊鏈嶅姟鍟嗙被鍨� -export function updateSupplierType(data) { - return request({ - url: "/api/st/updateSupplierType", - method: "put", - data - }) -} -// 鏈嶅姟鍟嗙被鍨嬪垪琛� -export const getSupplierTypeList = async (data) => { - return await axios.get(`/api/st/getSupplierTypeList`, { - params: data - }) -} - -// 涓婁紶鍚堝悓 -export const createContract = async (data) => { - return await axios.post(`/api/con/createContract`, data, { - headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" } - }) -} -// 鍒犻櫎鍚堝悓 -export function deleteContract(data) { - return request({ - url: "/api/con/deleteContract", - method: "delete", - data - }) -} -// 棰勮鍚堝悓 -export const previewContract = async (data) => { - return await axios.get(`/api/con/previewContract`, { - params: data - }) -} -// 涓嬭浇鍚堝悓 -export const downloadContract = async (data) => { - return await axios.get(`/api/con/downloadContract`, { - params: data - }) -} - -// 鏇存柊鎵�灞炶涓� -export function updateIndustry(data) { - return request({ - url: "/api/i/updateIndustry", - method: "put", - data - }) -} -// 鎵�灞炶涓氬垪琛� -export const getIndustryList = async (data) => { - return await axios.get(`/api/i/getIndustryList`, { - params: data - }) -} diff --git a/src/api/systemSetting/silkStandardSetting.js b/src/api/systemSetting/silkStandardSetting.js new file mode 100644 index 0000000..1c03b3e --- /dev/null +++ b/src/api/systemSetting/silkStandardSetting.js @@ -0,0 +1,17 @@ +import request from "@/common/untils/request.js" + +// 鍒涘缓鏈嶅姟鍟� +export function getRankStandard() { + return request({ + url: "/api-jl/v1/system/getRankStandard", + method: "get" + }) +} +// 鍒涘缓鏈嶅姟鍟� +export function saveRankStandard(data) { + return request({ + url: "/api-jl/v1/system/saveRankStandard", + method: "post", + data + }) +} diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index 01b1554..50ac390 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -1,121 +1,143 @@ +<!-- eslint-disable vue/no-use-v-if-with-v-for --> <template> - <div class="table-view"> + <div class="table-view" v-loading="loading"> <el-table ref="table" - :class="tableList.headerColor == 'red' ? 'table-red' : ''" border :data="tableList.tableInfomation" tooltip-effect="dark" - style="width: 100%" :height="'calc(100% - 0px)'" :max-height="tableList.maxHeight" + style="width: 100%" :lazy="tableList.lazy" - size="mini" + :show-summary="showSummary.show" + :summary-method="getSummaries" + :span-method="arraySpanMethod" @selection-change="handleSelectionChange" - :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }" - :highlight-current-row="tableList.highlight" - :row-class-name="tableRowClassName" + :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '12px', 'font-family': 'PingFangSC' }" + size="mini" @row-click="tableRowClick" - :row-key="tableList.key" - :default-expand-all="tableList.isDefaultExpandAll" - :tree-props="{ children: 'child', hasChildren: 'hasChildren' }" + :row-class-name="tableRowClassName" > - <el-table-column align="center" v-if="tableList.selectBox" type="selection" width="40"> </el-table-column> + <el-table-column v-if="selectBox" type="selection" width="40" :selectable="selectable"> </el-table-column> + <el-table-column v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"></el-table-column> <el-table-column - align="center" - v-if="tableList.selectIndex" - type="index" - label="搴忓彿" - width="50" - :fixed="tableList.fixed" + v-for="(item, i) in tableList.tableColumn" + :key="i" + :prop="item.prop" + :label="item.label" + :width="item.width" + :min-width="item.min" + show-overflow-tooltip + :sortable="item.sortable" + v-if="item.isShowColumn" > - </el-table-column> - <template v-for="(item, i) in tableList.tableColumn"> - <el-table-column - align="center" - :key="i" - :prop="item.prop" - :label="item.label" - :width="item.width" - :min-width="item.min" - show-overflow-tooltip - :sortable="item.sortable" - v-if="item.isShowColumn" - :fixed="item.fixed" - > - <template slot-scope="scope"> - <span v-if="item.price">{{ "锟�" + number_format(scope.row[item.prop], 2, ".", ",") }}</span> - <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div> - <span v-else-if="item.isTime">{{ - dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26" - ? "--" - : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) + <template slot-scope="scope"> + <span v-if="item.price">{{ "锟�" + number_format(scope.row[item.prop], 2, ".", ",") }}</span> + <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div> + <span v-else-if="item.isTime">{{ + dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26" + ? "--" + : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) + }}</span> + <span v-else-if="item.isClick && scope.row[item.prop]" class="sel-name" @click="selNameClick(scope.row)">{{ + scope.row[item.prop] + }}</span> + <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "鏄�" : "鍚�" }}</span> + <span + v-else-if="item.isSalesLeadClick && scope.row[item.prop]" + class="sel-name" + @click="selSalesLeadClick(scope.row)" + >{{ scope.row[item.prop] }}</span + > + <span + v-else-if="item.isClientClick && scope.row[item.prop]" + class="sel-name" + @click="selClientClick(scope.row)" + >{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span + > + <span + v-else-if="item.isContactClick && scope.row[item.prop]" + class="sel-name" + @click="selContactsClick(scope.row)" + >{{ scope.row[item.prop] }}</span + > + <span + v-else-if="item.isMasterClick && scope.row[item.prop]" + class="sel-name" + @click="selMasterClick(scope.row)" + >{{ scope.row[item.prop] }}</span + > + <span + v-else-if="item.isServiceOrder && scope.row[item.prop]" + class="sel-name" + @click="selServiceOrderClick(scope.row)" + >{{ scope.row[item.prop] }}</span + > + <span + v-else-if="item.isCommonClick && scope.row[item.prop]" + class="sel-name" + @click="selCommonClick(scope.row)" + >{{ scope.row[item.prop] }}</span + > + <div v-else-if="item.isProductName" class="product-view"> + <ul v-if="scope.row.products && scope.row.products.length > 0"> + <li v-for="(item, index) in scope.row.products" :key="index"> + <div class="name-view"> + {{ item.name }} + </div> + </li> + </ul> + <div v-else class="no-product">{{ "--" }}</div> + </div> + <div v-else-if="item.isProductAmount" class="product-view"> + <ul v-if="scope.row.products && scope.row.products.length > 0"> + <li v-for="(item, index) in scope.row.products" :key="index"> + <div class="name-view"> + {{ item.amount }} + </div> + </li> + </ul> + <div v-else class="no-product">{{ "--" }}</div> + </div> + <div v-else-if="item.isProductPrice" class="product-view"> + <ul v-if="scope.row.products && scope.row.products.length > 0"> + <li v-for="(item, index) in scope.row.products" :key="index"> + <div class="name-view"> + {{ item.price }} + </div> + </li> + </ul> + <div v-else class="no-product">{{ "--" }}</div> + </div> + <div v-else-if="item.isProductTotal" class="product-view"> + <ul v-if="scope.row.products && scope.row.products.length > 0"> + <li v-for="(item, index) in scope.row.products" :key="index"> + <div class="name-view"> + {{ item.total }} + </div> + </li> + </ul> + <div v-else class="no-product">{{ "--" }}</div> + </div> + <!-- 璋冪敤鏂规硶鏄剧ず鏂囧瓧 --> + <div v-else-if="item.isCallMethod"> + <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{ + item.getCallMethod(scope.row[item.prop], scope.row) }}</span> - <span - v-else-if="item.isClick && scope.row[item.prop]" - class="sel-name" - @click="selCommonClick(scope.row)" - >{{ scope.row[item.prop] }}</span - > - <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "鏄�" : "鍚�" }}</span> - <span - v-else-if="item.isCommonClick && scope.row[item.prop]" - class="sel-name" - @click="selCommonClick(scope.row)" - >{{ scope.row[item.prop] }}</span - > - <div v-else-if="item.isProductName" class="product-view"> - <ul v-if="scope.row.products && scope.row.products.length > 0"> - <li v-for="(item, index) in scope.row.products" :key="index"> - <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'"> - {{ item.name }} - </div> - </li> - </ul> - <div v-else class="no-product">{{ "--" }}</div> - </div> - <div v-else-if="item.isProductAmount" class="product-view"> - <ul v-if="scope.row.products && scope.row.products.length > 0"> - <li v-for="(item, index) in scope.row.products" :key="index"> - <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'"> - {{ item.amount }} - </div> - </li> - </ul> - <div v-else class="no-product">{{ "--" }}</div> - </div> - <div v-else-if="item.isProductPrice" class="product-view"> - <ul v-if="scope.row.products && scope.row.products.length > 0"> - <li v-for="(item, index) in scope.row.products" :key="index"> - <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'"> - {{ item.price }} - </div> - </li> - </ul> - <div v-else class="no-product">{{ "--" }}</div> - </div> - <div v-else-if="item.isProductTotal" class="product-view"> - <ul v-if="scope.row.products && scope.row.products.length > 0"> - <li v-for="(item, index) in scope.row.products" :key="index"> - <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'"> - {{ item.total }} - </div> - </li> - </ul> - <div v-else class="no-product">{{ "--" }}</div> - </div> - <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span> - </template> - </el-table-column> - </template> + </div> + <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span> + </template> + </el-table-column> <slot name="tableButton" /> <div slot="empty"> <el-empty description="鏆傛棤鏁版嵁"></el-empty> </div> </el-table> + <div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div> <div class="styleBtn"> - <i @click="checkCol()" v-if="colOpenShow" class="label">...</i> + <i @click="checkCol()" class="label">...</i> <el-checkbox-group v-model="showcol" v-show="iscolopen" class="checkbox-group" @change="selectCheckBoxList"> <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox> </el-checkbox-group> @@ -127,17 +149,18 @@ export default { name: "TableCommonView", props: { + selectBox: { + type: Boolean, + default: false + }, tableList: { type: Object, default: () => { return { - selectBox: false, - selectIndex: false, - fixed: false, + selectIndex: true, tableInfomation: [], // 鎺ュ彛杩斿洖鏁版嵁 showcol: [], allcol: [], - highlight: false, tableColumn: [ // table琛ㄥ崟 { label: "", prop: "", min: 200, tooltip: true } @@ -145,19 +168,13 @@ } } }, - // 鏄惁鍙互閰嶇疆鍒楄〃 琛ㄥご - colOpenShow: { - type: Boolean, - default: true - }, showSummary: { type: Object, default: () => { return { show: false, sumProp: [], - mergeNumber: 1, - totalName: "鏈〉鎬昏" + mergeNumber: 1 } } }, @@ -167,14 +184,24 @@ default: () => { return {} } + }, + loading: { + type: Boolean, + default: false + }, + selectBoxList: { + type: Array, + default: () => [] } }, + data() { return { iscolopen: false, showcol: [] } }, + computed: {}, watch: { "tableList.showcol": { handler(newVal) { @@ -183,7 +210,6 @@ immediate: true } }, - computed: {}, methods: { onMaskClick() { this.iscolopen = false @@ -210,10 +236,16 @@ .querySelector(".el-table__footer") var cell = current.rows[0].cells for (let i = 0; i < this.showSummary.mergeNumber; i++) { - cell[i].style.display = "none" + cell[i] && cell[i].style && (cell[i].style.display = "none") } - cell[this.showSummary.mergeNumber].classList.remove("is-left") - cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString() + if (cell[this.showSummary.mergeNumber]) { + if (cell[this.showSummary.mergeNumber].classList) { + cell[this.showSummary.mergeNumber].classList.remove("is-left") + } + if (cell[this.showSummary.mergeNumber].colSpan) { + cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString() + } + } } }) } @@ -225,7 +257,7 @@ const sums = [] columns.forEach((column, index) => { if (index === this.showSummary.mergeNumber) { - sums[index] = this.showSummary.totalName + sums[index] = "鏈〉鎬昏" } const values = data.map((item) => Number(item[column.property])) if (this.showSummary.sumProp.includes(column.property)) { @@ -324,9 +356,37 @@ } return fmt }, - // 鍏叡璇︽儏 + // 鏂板缓缂栬緫閫夋嫨寮圭獥 + selNameClick(row) { + this.$emit("selCommonClick", row) + }, + // 閿�鍞嚎绱� + selSalesLeadClick(row) { + this.$emit("selSalesLeadClick", row) + }, + // 瀹㈡埛鍚嶇О + selClientClick(row) { + this.$emit("selClientClick", row) + }, + // 鑱旂郴浜哄鍚� + selContactsClick(row) { + this.$emit("selContactsClick", row) + }, + // 閿�鍞�诲崟 + selMasterClick(row) { + this.$emit("selMasterClick", row) + }, + // 瀹㈡埛鏈嶅姟鍗� + selServiceOrderClick(row) { + this.$emit("selServiceOrderClick", row) + }, + // 鍏叡锛堥攢鍞満浼氥�佹姤浠峰崟銆侀攢鍞�诲崟銆侀攢鍞瓙鍗曘�傘�傘�傦級 selCommonClick(row) { this.$emit("selCommonClick", row) + }, + // 琛岀偣鍑� + tableRowClick(row, column, event) { + this.$emit("tableRowClick", row, column, event) }, // 鍗曢�夎鐩稿叧 tableRowClassName({ row }) { @@ -337,8 +397,13 @@ } this.$emit("tableRowClassName", row) }, - tableRowClick(row) { - this.$emit("tableRowClick", row) + selectable(row) { + let list = this.selectBoxList.map((item) => item.number) + if (list.findIndex((v) => v == row.number) == -1) { + return true + } else { + return false + } } } } @@ -347,9 +412,6 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .table-view { - // margin-top: 20px; - // margin-right: 10px; - // margin-bottom: 40px; position: relative; height: 100%; .blue { @@ -368,19 +430,22 @@ margin-left: -10px; margin-right: -11px; li { - height: 57px; - line-height: 57px; + height: 22px; + line-height: 22px; .name-view { padding-left: 10px; border-bottom: 1px solid #ebeef5; } .no-bottom { - border-bottom: 0px; + border-bottom: 0; } } + li:last-child .name-view { + border-bottom: none; + } .no-product { - height: 57px; - line-height: 57px; + height: 22px; + line-height: 22px; } } } @@ -409,13 +474,17 @@ height: 35px; text-align: center; } -::v-deep .table-red.el-table th.el-table__cell > .cell { - color: red; -} + ::v-deep { .el-table .cell .el-button--text.el-button--small { padding: 4px 0; } +} + +::v-deep .el-table .el-table__cell { + padding: 6px 0 !important; + height: 35px; + text-align: center; } .overSpread1 { @@ -435,8 +504,8 @@ // line-height: 26px; // background: #06c062; top: 0; - right: 2px; - z-index: 9999; + right: -6px; + z-index: 11; .label { position: absolute; top: 6px; @@ -448,7 +517,7 @@ } .checkbox-group { width: 160px; - height: 330px; + height: 300px; overflow: auto; display: flex; flex-direction: column; diff --git a/src/views/other/commonDialog/EditDropdownDialog.vue b/src/views/other/commonDialog/EditDropdownDialog.vue index 61713a6..2abc4e2 100644 --- a/src/views/other/commonDialog/EditDropdownDialog.vue +++ b/src/views/other/commonDialog/EditDropdownDialog.vue @@ -211,3 +211,4 @@ margin-left: 0px; } </style> +@/api/systemSetting/supplier diff --git a/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue b/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue index 8875782..d900a09 100644 --- a/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue +++ b/src/views/systemSetting/silkStandardSetting/components/silkTableList.vue @@ -67,7 +67,7 @@ :disabled="!isOperate" @change=" (val) => { - commonInputChange(val, item.prop, scope.row, scope) + commonInputChange(val, item.prop, scope) } " ></el-input> @@ -83,7 +83,7 @@ v-for="(item, index) in projectOptions" :key="index" :label="item.value" - :value="item.value" + :value="item.id" > </el-option> </el-select> @@ -162,6 +162,11 @@ " ></el-input-number> </el-form-item> + <div v-else-if="item.isCallMethod"> + <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{ + item.getCallMethod(scope.row[item.prop], scope.row) + }}</span> + </div> <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span> </template> </el-table-column> @@ -198,6 +203,7 @@ <script> // import { getProductList } from "@/api/common/other" +import { getDataByType } from "@/api/data" export default { name: "CommmonFormTableView", components: {}, @@ -250,13 +256,7 @@ productList: [], tableList: [], projectIndex: 0, - projectOptions: [ - { id: 1, value: "绾ゅ害鍋忓樊" }, - { id: 2, value: "浜屾鍙樺寲" }, - { id: 3, value: "娓呮磥鍒�" }, - { id: 4, value: "娲佸噣鍒�" }, - { id: 5, value: "鏈�澶у亸宸�" } - ] + projectOptions: getDataByType("projectOptions") } }, created() { @@ -299,8 +299,8 @@ this.$emit("addProjectClick") } }, - commonInputChange(val, prop, row, scope) { - this.$emit("inputContent", val, prop, row, scope) + commonInputChange(val, prop, scope) { + this.$emit("inputContent", val, prop, scope) }, // 鍒犻櫎 deleteClick(scope) { @@ -317,6 +317,7 @@ // 娣诲姞鍒楀ご閮ㄦ爣棰樿緭鍏� addColumnInputChange(val, prop) { console.log(val, prop, "娣诲姞鍒楀ご閮ㄦ爣棰樿緭鍏�") + this.$emit("addColumnInputChange", val, prop) }, // 鍒犻櫎鍒� clearupColumn(prop) { diff --git a/src/views/systemSetting/silkStandardSetting/index.vue b/src/views/systemSetting/silkStandardSetting/index.vue index 43383a0..f5a7c22 100644 --- a/src/views/systemSetting/silkStandardSetting/index.vue +++ b/src/views/systemSetting/silkStandardSetting/index.vue @@ -5,7 +5,7 @@ <template slot="leftButton"> <el-button size="small" type="primary" @click="addBtnClick" :disabled="!isEdit">鏂板</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="printClick" disabled>鎵撳嵃</el-button> </template> </CommonSearch> </div> @@ -26,6 +26,7 @@ @deleteClick="clearupProject" @addColumnClick="addColumnClick" @clearupColumn="clearupColumn" + @addColumnInputChange="addColumnInputChange" > </SilkTableList> </div> @@ -35,6 +36,8 @@ <script> import SilkTableList from "@/views/systemSetting/silkStandardSetting/components/silkTableList" +import { getRankStandard, saveRankStandard } from "@/api/systemSetting/silkStandardSetting" +import { getDataByType } from "@/api/data" export default { name: "silkStandardSetting", props: {}, @@ -46,29 +49,90 @@ isEdit: false, silkTableList: {}, tableData: [], - 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: "price3", inputFloat: true } + defaultColumn: [ + { + label: "妫�鏌ラ」鐩悕绉�", + prop: "checkItem", + projectName: true, + isCallMethod: true, + getCallMethod: this.getCheckItemName + }, + { label: "寮�濮嬬氦搴�", prop: "startFineness", inputFloat: true }, + { label: "缁撴潫绾ゅ害", prop: "endFineness", inputFloat: true }, + { label: "閲庣氦", prop: "rankA", inputFloat: true }, + { label: "澶ч噹", prop: "rankB", inputFloat: true }, + { label: "鐗归噹", prop: "rankC", inputFloat: true } ], + tableColumn: [], columnNum: 0, dataObj: { - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0 - } + checkItem: 1, + startFineness: 0, + endFineness: 0, + rankA: 0, + rankB: 0, + rankC: 0 + }, + projectOptions: getDataByType("projectOptions"), + rankObj: {}, + columnInputList: [], + dynamicsRanks: [] } }, created() { this.setTableForm() + this.getData() }, methods: { + // 鑾峰彇鏁版嵁 + getData() { + getRankStandard().then((res) => { + console.log(res) + if (res.code === 200) { + if (res.data.length > 0) { + this.tableData = [] + this.tableColumn = this.defaultColumn + this.columnDataProcess(res.data[0].dynamicsRanks) + this.rankObj = {} + this.allDataProcess(res.data) + } + } + }) + }, + // 鏁翠綋鏁版嵁澶勭悊 + allDataProcess(dataList) { + let rankList = dataList.map((ite) => { + for (let i = 0; i < ite.dynamicsRanks.length; i++) { + this.$set(this.rankObj, ite.dynamicsRanks[i].rankProp, ite.dynamicsRanks[i].rankValue) + this.$set(this.dataObj, ite.dynamicsRanks[i].rankProp, 0) + } + return { + ...ite, + ...this.rankObj + } + }) + this.tableData = rankList || [] + this.silkTableList.tableData = this.tableData + }, + // 鍒椾俊鎭暟鎹鐞� + columnDataProcess(data) { + this.columnInputList = data.map((ite) => { + return { ...ite } + }) + let list = data.map((item) => { + return { + label: item.rankName, + prop: item.rankProp, + inputFloat: true + } + }) + this.columnNum = list.length + 1 + for (let j = 0; j < list.length; j++) { + this.tableColumn.splice(2, 0, list[j]) + } + console.log(this.tableColumn) + this.silkTableList.tableColumn = this.tableColumn + }, setTableForm() { this.silkTableList = { tableData: this.tableData, @@ -85,12 +149,33 @@ this.tableData.push(this.dataObj) }, // 鍒锋柊 - refreshClick() {}, + refreshClick() { + this.getData() + }, // 鎵撳嵃 printClick() {}, // 鍒楄〃杈撳叆鍥炶皟 - inputContent(val, prop, row) { - console.log(val, prop, row) + inputContent(val, prop, scope) { + console.log(val, prop, scope) + let list = this.tableData.map((item, index) => { + let dynamicsRanks = this.columnInputList.map((ite) => { + if (ite.rankProp == prop) { + ite.rankValue = val + } + return { + ...ite + } + }) + if (index === scope.$index) { + item[prop] = val + item.dynamicsRanks = dynamicsRanks + } + return { + ...item + } + }) + console.log(list) + this.tableData = list }, // 鍒犻櫎 clearupProject(data, index) { @@ -100,15 +185,53 @@ // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 editSaveClick() { this.isEdit = !this.isEdit + if (!this.isEdit) { + let params = this.saveParam() + saveRankStandard({ + rankStandard: params + }).then((res) => { + console.log(res) + if (res.code == 200) { + this.$message.success("淇濆瓨鎴愬姛") + this.getData() + } + }) + } + }, + saveParam() { + let saveList = this.tableData.map((item) => { + return { + checkItem: item.checkItem, + dynamicsRanks: item.dynamicsRanks, + endFineness: item.endFineness, + lineId: item.lineId || "", + rankA: item.rankA, + rankB: item.rankB, + rankC: item.rankC, + startFineness: item.startFineness + } + }) + return saveList }, // 娣诲姞鍒� addColumnClick() { - let propStr = "trends" + this.columnNum + let propStr = "prop" + 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.$set(this.rankObj, propStr, 0) + console.log(this.columnInputList) + this.columnInputList.push({ rankProp: propStr, rankName: "", rankValue: 0 }) + console.log(this.tableColumn, this.dataObj, "32323", this.columnInputList) this.silkTableList.tableColumn = this.tableColumn this.columnNum += 1 + let allList = this.tableData.map((item) => { + return { + ...item, + [propStr]: 0 + } + }) + this.tableData = allList + this.silkTableList.tableData = allList }, // 鍒犻櫎鍒� clearupColumn(prop) { @@ -121,6 +244,27 @@ this.tableColumn.splice(currentIndex, 1) this.silkTableList.tableColumn = this.tableColumn this.$delete(this.dataObj, prop) + }, + // 鍒楄〃澶磋緭鍏ュ洖璋� + addColumnInputChange(val, prop) { + console.log(val, prop, this.columnInputList) + this.columnInputList.forEach((item) => { + if (item.rankProp == prop) { + item.rankName = val + } + }) + console.log(this.columnInputList, "888") + }, + getCheckItemName(val) { + if (val) { + for (let i in this.projectOptions) { + if (this.projectOptions[i].id == val) { + return this.projectOptions[i].value + } + } + } else { + return "--" + } } } } diff --git a/vue.config.js b/vue.config.js index b48fa64..268056c 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,10 +14,9 @@ devServer: { proxy: { "/api": { - // target: "http://192.168.20.118:8889", // http://192.168.20.119:8002 http://fai365.com:30150/ - // target: "http://192.168.20.120:8004", - target: "http://192.168.20.119:8004", // http://192.168.20.119:8004 http://fai365.com:30150/ + // target: "http://192.168.20.120:8004", + target: "http://192.168.20.119:8008", // http://192.168.20.119:8004 http://fai365.com:30150/ ws: true, changeOrigin: true -- Gitblit v1.8.0