From db64fc3d6ff2809ec6b5d8cc42a21c67746df209 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 25 八月 2023 19:23:46 +0800 Subject: [PATCH] 采购订单的 添加 2023-8-25 --- src/components/makepager/TableCommonView.vue | 2 src/api/purchaseManage/purchase.js | 99 +++ src/assets/style/index.scss | 115 +++ src/views/purchaseManage/purchase/components/SelectClientDialog.vue | 192 +++++ src/views/purchaseManage/purchase/components/AddPurchase.vue | 704 +++++++++++++++++++++ src/views/purchaseManage/purchase/index.vue | 39 src/components/makepager/CommonFormTableView.vue | 14 src/views/purchaseManage/purchase/components/AddPurchase2.vue | 536 ++++++++++++++++ src/views/purchaseManage/purchase/components/BomDialog.vue | 272 ++++++++ 9 files changed, 1,960 insertions(+), 13 deletions(-) diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js new file mode 100644 index 0000000..cefa894 --- /dev/null +++ b/src/api/purchaseManage/purchase.js @@ -0,0 +1,99 @@ +import request from "@/common/untils/request.js" + +// 閿�鍞嚎绱㈠垪琛� +export function getSalesLeadsList(data) { + return request({ + url: "/api/salesLeads/list", + method: "post", + data + }) +} +// 娣诲姞閿�鍞嚎绱� +export function getAddSalesLeads(data) { + return request({ + url: "/api/salesLeads/add", + method: "post", + data + }) +} +// 鍒犻櫎閿�鍞嚎绱� +export function getDeleteSalesLeads(data) { + return request({ + url: "/api/salesLeads/delete", + method: "delete", + data + }) +} +// 鏇存柊閿�鍞嚎绱� +export function getUpdateSalesLeads(data) { + return request({ + url: "/api/salesLeads/update", + method: "put", + data + }) +} + +// 鎺ㄨ繘閿�鍞嚎绱� +export function pushSalesSources(data) { + return request({ + url: "/api/salesLeads/push", + method: "post", + data + }) +} + +// 鍟嗘満鏉ユ簮鍒楄〃 +export function getSalesSourcesList() { + return request({ + url: "/api/salesSources/list", + method: "get" + }) +} +// 娣诲姞鎶ヤ环鍗� +export function getAddQuotation(data) { + return request({ + url: "/api/quotation/add", + method: "post", + data + }) +} +// 鏇存柊鎶ヤ环鍗� +export function getUpdateQuotation(data) { + return request({ + url: "/api/quotation/update", + method: "put", + data + }) +} +// 鑾峰彇瀹㈡埛鏉ユ簮绛夋墍鏈夋暟鎹� +export function getAllData() { + return request({ + url: "/api/data/getAllData", + method: "get" + }) +} +// 瀹㈡埛绠$悊鍒楄〃 +export function getClientList(data) { + return request({ + url: "/api/client/list", + method: "post", + data + }) +} +// ----bom --- 瑷堥噺鍠綅 鐨勬暩鎿� +export function postGetUnitDictList(data) { + return request({ + url: "/api-s/v1/dict/getUnitDictList", + method: "post", + data + }) +} + +// ----bom --- 瑷堥噺鍠綅 鐨勬暩鎿� 鏇存柊 +export function postGetSaveSUnitDict(data) { + return request({ + url: "/api-s/v1/dict/saveUnitDict", + method: "post", + data + }) +} \ No newline at end of file diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index 361de82..bed3e65 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -11,3 +11,118 @@ border: 0; outline: 0; } +// 闂磋窛 +.margin_left_3px{ + margin-left:3px; +} +.margin_left_5px{ + margin-left:5px; +} +.margin_left_10px{ + margin-left:10px; +} +.margin_left_15px{ + margin-left:15px; +} +.margin_left_20px{ + margin-left:20px; +} +.margin_right_5px{ + margin-right:5px; +} +.margin_right_10px{ + margin-right:10px; +} +.margin_right_15px{ + margin-right:15px!important; +} +.margin_right_20px{ + margin-right:20px; +} +.margin_right_40px{ + margin-right:40px; +} +.margin_top_10px{ + margin-top:10px; +} +.margin_top_20px{ + margin-top:20px; +} +.margin_top_30px{ + margin-top:30px; +} +.margin_top_35px{ + margin-top:35px; +} +.margin_top_40px{ + margin-top:40px; +} +.margin_bottom_2px{ + margin-bottom:2px; +} +.margin_bottom_10px{ + margin-bottom:10px!important; +} +.margin_bottom_15px{ + margin-bottom:15px!important; +} +.margin_bottom_20px{ + margin-bottom:20px!important; +} +.margin_bottom_30px{ + margin-bottom:30px!important; +} +.margin_bottom_40px{ + margin-bottom:40px!important; +} +.margin_bottom_50px{ + margin-bottom:50px!important; +} +// +.float_left{ + float:left; +} +.float_right{ + float:right; +} +// +.line_height_32px{ + line-height:32px; +} +.text_indent_20{ + text-indent:20px; +} +.text_indent_30{ + text-indent:30px; +} +// 瀛椾綋澶у皬 +.font_size_12{ + font-size:12px; +} +.font_size_13{ + font-size:13px; +} +.font_size_14{ + font-size:14px; +} +.font_size_15{ + font-size:15px; +} +.font_size_16{ + font-size:16px; +} +.font_size_18{ + font-size:18px; +} +.font_size_20{ + font-size:20px!important; +} +.font_size_30{ + font-size:30px!important; +} +.font_size_40{ + font-size:40px!important; +} +.cursor_pointer{ + cursor: pointer; +} \ No newline at end of file diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 55fee16..035740b 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -63,7 +63,7 @@ <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> <div class="common-select-btn" @click="clearupClient(scope.row)"> - <i class="el-icon-edit-outline" title="娓呴櫎"></i> + <i class="el-icon-remove-outline" title="娓呴櫎"></i> </div> </div> </el-form-item> @@ -129,7 +129,7 @@ <el-button size="small" type="primary" @click="add">鏂板</el-button> <!-- <el-button size="small" type="primary" disabled>瀵煎叆鏄庣粏</el-button> --> <el-button size="small" type="primary" @click="empty">娓呯┖</el-button> - <el-button size="small" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true" + <el-button size="small" v-if="recalculateShow" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true" >閲嶇畻</el-button > </div> @@ -185,10 +185,16 @@ total: false, refundable: false, sumProp: [], + titleProp:["#", "浜у搧鍚嶇О"], mergeNumber: 1 } } - } + }, + recalculateShow:{ + type:[Boolean], + defalut:true, + }, + }, data() { return { @@ -263,7 +269,7 @@ sums[index] = "灏忚:" return } - const title = ["#", "浜у搧鍚嶇О"] + const title = this.showSummary.titleProp // 鍘婚櫎鏌愪簺涓嶉渶瑕佽绠楃殑鏁版嵁 if (title.includes(column.label)) { sums[index] = "" diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index bb3f2c3..25cf1d1 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -33,7 +33,7 @@ ? "--" : 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)">{{ + <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> diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue new file mode 100644 index 0000000..816cb6d --- /dev/null +++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue @@ -0,0 +1,704 @@ +<template> + <div class="add-quotation"> + <el-dialog + :title="editCommonConfig.title + '閲囪喘鍗�'" + :visible.sync="editConfig.visible" + :width="dialogWidth" + :before-close="handleClose" + append-to-body + custom-class="iframe-dialog" + > + <el-form + ref="form" + :model="editConfig.infomation" + :rules="rules" + label-position="right" + label-width="130px" + size="mini" + style="height: 60vh; overflow-x: hidden" + > + <!-- 淇℃伅 --> + <div class="basic-info"> + <!-- 鍩烘湰淇℃伅 --> + <div class="basic-info-title">鍩烘湰淇℃伅</div> + <div class="basic-info-view"> + <el-row> + <el-col :span="12"> + <el-form-item + label="閲囪喘绫诲瀷" + prop="brand" + class="form-item float_left" + > + <el-select + placeholder="璇烽�夋嫨閲囪喘绫诲瀷" + v-model="editConfig.infomation.client_name" + clearable + style="width: calc(100% - 30px)" + > + <el-option + v-for="ele in plcBrandList" + :key="ele.id" + :label="ele.name" + :value="ele.name" + ></el-option> + </el-select> + <i + class="el-icon-setting margin_left_10px cursor_pointer" + style="font-size: 20px; color: #333" + @click="handleShow" + ></i> + </el-form-item> + </el-col> + + <el-col :span="12"> + <el-form-item label="渚涘簲鍟嗗悕绉�" prop="client_name"> + <div class="custom-name"> + <el-autocomplete + style="width: calc(100% - 40px)" + v-model="editConfig.infomation.client_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client'); + } + " + value-key="name" + placeholder="璇烽�夋嫨" + @select="handleSelectClient('client', $event)" + ></el-autocomplete> + <div + class="common-select-btn" + @click="selClientClick('client')" + > + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div + v-if=" + editConfig.infomation.client_name && + editConfig.infomation.client_name.length > 0 + " + class="common-select-btn" + @click="clearupClient('client')" + > + <i class="el-icon-remove-outline" title="娓呴櫎"></i> + </div> + </div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍗曟嵁鏉ユ簮" prop="number"> + <el-input + v-model="editConfig.infomation.number" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閲囪喘鍗曞悕绉�" prop="number"> + <el-input + v-model="editConfig.infomation.number" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="number"> + <el-input + v-model="editConfig.infomation.number" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴鐢佃瘽" prop="contact_phone"> + <el-input + v-model="editConfig.infomation.contact_phone" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绛剧害鏃ユ湡" prop="validity_date"> + <el-date-picker + v-model="editConfig.infomation.validity_date" + style="width: 100%" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浜や粯鏃ユ湡" prop="validity_date"> + <el-date-picker + v-model="editConfig.infomation.validity_date" + style="width: 100%" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞淇℃伅" prop="member_id"> + <el-input + type="textarea" + :autosize="{ minRows: 3, maxRows: 4 }" + maxlength="500" + clearable + v-model="editConfig.infomation.member_id" + ></el-input> + </el-form-item> + </el-col> + </el-row> + </div> + <!-- 浜у搧绠$悊 --> + <div class="basic-info-title" style="display: flex">浜у搧淇℃伅</div> + <div class="product-view"> + <CommonFormTableView + :show-summary="showSummary" + :recalculateShow="false" + :product-table-list="productTableList" + @inputContent="inputContent" + @addProductClick="addProductClick" + @emptyProductClick="emptyProductClick" + @recalculateProductClick="recalculateProductClick" + @clearupProduct="clearupProduct" + /> + </div> + <div class="table-bottom"> + <div class="table-bottom-item"> + <div class="table-bottom-l"> + <el-form-item label="鏁村崟鎶樻墸" prop="member_id"> + <el-select + v-model="editConfig.infomation.fieldName" + placeholder="璇烽�夋嫨" + filterable + > + <el-option label="鐧惧垎姣旈檷浠�" :value="1"></el-option> + <el-option label="鐩存帴闄嶄环" :value="2"></el-option> + </el-select> + </el-form-item> + </div> + <div class="table-bottom-r"> + <el-form-item label="" prop="member_id"> + <el-input + v-model="editConfig.infomation.number" + size="mini" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </div> + </div> + <div class="table-bottom-item"> + <div class="table-bottom-l"> + <el-form-item label="璋冩暣" prop="member_id"> + <el-select + v-model="editConfig.infomation.fieldName" + placeholder="璇烽�夋嫨" + filterable + > + <el-option label="澧炲姞" :value="1"></el-option> + <el-option label="鍑忓皯" :value="2"></el-option> + </el-select> + </el-form-item> + </div> + <div class="table-bottom-r"> + <el-form-item label="" prop="member_id"> + <el-input + v-model="editConfig.infomation.number" + size="mini" + placeholder="璇峰~鍐�" + ></el-input> + </el-form-item> + </div> + </div> + <div class="table-bottom-item"> + <div class="table-bottom-l">鍚堣</div> + <div class="table-bottom-r">26000.00</div> + </div> + </div> + </div> + </el-form> + <div slot="footer" class="dialog-footer"> + <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> + <el-button type="primary" size="small" @click="saveClick('form')" + >淇濆瓨</el-button + > + <el-button size="small" @click="editConfig.visible = false" + >鍙栨秷</el-button + > + </div> + <!-- 閫夋嫨瀹㈡埛 --> + <SelectClientDialog + v-if="editSelectClientConfig.editVisible" + :edit-common-config="editSelectClientConfig" + @selClient="selClient" + /> + </el-dialog> + <BomDialog + ref="editDialog" + @sucessSet="handleGetBomKindDictList" + @handleConfirmSave="handleConfirmSave" + :workList="plcBrandList" + title="閲囪喘绫诲瀷" + ></BomDialog> + </div> +</template> + +<script> +import CommonFormTableView from "@/components/makepager/CommonFormTableView"; +import BomDialog from "@/views/purchaseManage/purchase/components/BomDialog"; +import { + getAddQuotation, + getUpdateQuotation, + getAllData, +} from "@/api/purchaseManage/purchase"; +// import { +// postGetUnitDictList, +// postGetSaveSUnitDict, +// } from "@/api/purchaseManage/purchase"; +import SelectClientDialog from "@/views/purchaseManage/purchase/components/SelectClientDialog"; +export default { + name: "QuotationDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + visible: false, + title: "鍒涘缓", + infomation: {}, + }; + }, + }, + }, + components: { SelectClientDialog, CommonFormTableView,BomDialog }, + computed: { + searchCommonHeight() { + return this.$refs.searchCommonView.offsetHeight; + }, + contactNamelist() { + return this.$store.state.getClientName.contactNamelist; + }, + }, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + rules: { + client_id: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + quotation_status_id: [ + { required: true, message: "璇烽�夋嫨", trigger: "change" }, + ], + member_id: [ + { required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" }, + ], + contact_phone: [ + { + required: true, + message: "璇峰~鍐�", + trigger: "change", + }, + { validator: this.validatorPhone, trigger: "change" }, + ], + }, + memberOptions: [], + quotationStatusOptions: [{ id: 1, name: "涓嶇煡閬�" }], // 鎶ヤ环鍗曠姸鎬� + currencyOptions: [{ id: 1, name: "浜烘皯甯�" }], // 甯佺 + approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ + productTableList: {}, + showSummary: { + show: true, + total: false, + sumProp: ["Amount", "total"], + titleProp: [ + "缂栧彿", + "浜у搧鍚嶇О", + "浜у搧缂栧彿", + "璁¢噺鍗曚綅", + "瑙勬牸鍨嬪彿", + "閲囪喘鍗曚环", + "鎻忚堪", + ], + mergeNumber: 4, + }, + editSelectClientConfig: { + editVisible: false, + title: "", + infomation: {}, + }, + clientId: this.editCommonConfig.infomation.client_id, + contactId: this.editCommonConfig.infomation.contact_id, + saleChanceId: this.editCommonConfig.infomation.sale_chance_id, + tableData: [], + productId: 1, + isNoProduct: true, + clientList: [], + plcBrandList:[], + }; + }, + created() { + this.setTableForm(); + this.getCommonData(); + }, + methods: { + // PLC閰嶇疆璁剧疆 + handleShow() { + // this.handleGetBomKindDictList(); + this.$refs.editDialog.editDialogVisible = true; + }, + // PLC閰嶇疆 + handleGetBomKindDictList(val) { + console.log(val,'val') + // postGetUnitDictList().then((res) => { + // this.plcBrandList = res.data; + // if (val) { + // for (let i in this.plcBrandList) { + // if (this.plcBrandList[i].isDefault) { + // this.form.unit = this.form.unit + // ? this.form.unit + // : this.plcBrandList[i].name; + // this.$set(this.form, "unit", this.form.unit); + // break; + // } + // } + // } + // }); + }, + handleConfirmSave(data) { + console.log(data,'data') + // postGetSaveSUnitDict({ data: data }).then((res) => { + // if (res.code == 200) { + // this.$message({ + // message: "鎿嶄綔鎴愬姛锛�", + // type: "success", + // }); + // this.$refs.editDialog.editDialogVisible = false; + // this.handleGetBomKindDictList(); + // } + // }); + }, + validatorPhone(rule, value, callback) { + if (value) { + if (value == undefined || value == null) { + callback(new Error("璇疯緭鍏�")); + } else { + if (value.length != 11) { + callback(new Error("闀垮害鍦�11涓瓧绗︼紒")); + } else { + var reg = + /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/; + if (!reg.test(value)) { + callback(new Error("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽锛�")); + } else { + callback(); + } + } + } + } else { + callback(); + } + }, + getCommonData() { + getAllData() + .then((res) => { + this.memberOptions = res.data.member; + this.quotationStatusOptions = res.data.quotationStatus; + }) + .catch((err) => { + console.log(err); + }); + }, + + // 淇濆瓨 + saveClick(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].name.length === 0) { + this.isNoProduct = true; + break; + } else { + this.isNoProduct = false; + } + } + if (this.isNoProduct) { + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖"); + } else { + const params = this.saveParams(); + console.log(params); + if (this.editConfig.title === "鍒涘缓") { + getAddQuotation(params).then((res) => { + console.log(res); + this.editConfig.visible = false; + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛"); + this.$parent.getData(); + } + }); + } else { + getUpdateQuotation(params).then((res) => { + this.editConfig.visible = false; + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛"); + this.$parent.getData(); + } + }); + } + } + } else { + console.log("error submit"); + return false; + } + }); + }, + saveParams() { + let data = this.editConfig.infomation; + let params = { + id: this.editConfig.title === "鍒涘缓" ? 0 : data.id, + client_id: this.clientId || 0, + conditions: data.conditions || "", + contact_id: this.contactId || 0, + file: data.file || "", + member_id: data.member_id || 0, + number: data.number || "", + quotation_status_id: data.quotation_status_id || 0, + sale_chance_id: this.saleChanceId || 0, + validity_date: data.validity_date || "", + products: this.tableData, + }; + return params; + }, + handleClose() { + this.editConfig.visible = false; + }, + // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 + querySearchAsync(queryString, cb, value) { + var restaurants = []; + if (value === "client") { + restaurants = this.clientList; + } else if (value === "contact") { + restaurants = this.contactNamelist; + } + var results = queryString + ? restaurants.filter(this.createStateFilter(queryString)) + : restaurants; + cb(results); + }, + createStateFilter(queryString) { + return (state) => { + return ( + state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + ); + }; + }, + handleSelectClient(value, item) { + console.log(value); + if (value === "client") { + this.clientId = item.id; + } else if (value === "chance") { + this.saleChanceId = item.id; + } else { + this.contactId = item.id; + } + }, + selClientClick() { + this.editSelectClientConfig.editVisible = true; + }, + selClient(row) { + this.editConfig.infomation.client_name = row.name; + this.clientId = row.id; + }, + // 娓呴櫎宸查�夋嫨鐢ㄦ埛 + clearupClient(value) { + if (value == "client") { + this.editConfig.infomation.client_name = ""; + this.$set(this.editConfig.infomation, "client_name", ""); + this.clientId = null; + this.$forceUpdate(); + } + }, + // 娣诲姞闄勪欢 + addAnnexClick() {}, + // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡 + setFormatClick() {}, + setTableForm() { + if ( + this.editConfig.title === "鍒涘缓" || + this.editConfig.infomation.products.length === 0 + ) { + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0, + }, + ]; + } else { + this.tableData = this.editConfig.infomation.products; + this.tableData.map((item, index) => { + item.productId = index + 1; + }); + } + this.productTableList = { + tableData: this.tableData, + tableColumn: [ + { label: "缂栧彿", prop: "productId", width: 40 }, + { + label: "浜у搧鍚嶇О", + prop: "name", + productName: true, + isRequird: true, + }, + { label: "浜у搧缂栧彿", prop: "number" }, + { label: "璁¢噺鍗曚綅", prop: "number" }, + { label: "瑙勬牸鍨嬪彿", prop: "number" }, + { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, + { + label: "閲囪喘鍗曚环", + prop: "price", + inputFloat: true, + isRequird: true, + }, + { label: "浠风◣鍚堣", prop: "total", inputFloat: true }, + { label: "鎻忚堪", prop: "name", input: true }, + ], + }; + }, + // 浜у搧鍒楄〃杈撳叆 + inputContent(val, prop, row) { + this.productId = row.productId; + this.tableData.map((item) => { + if (item.productId === row.productId) { + item[prop] = val; + } + }); + }, + // 浜у搧鏂板 + addProductClick() { + this.productId++; + this.tableData.push({ + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0, + }); + this.showSummary.show = true; + }, + // 浜у搧娓呯┖ + emptyProductClick() { + this.productId = 1; + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0, + }, + ]; + this.productTableList.tableData = this.tableData; + }, + // 浜у搧閲嶇畻 + recalculateProductClick() {}, + clearupProduct(data) { + this.tableData = data; + this.productTableList.tableData = this.tableData; + }, + }, +}; +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.table-bottom { + width: 500px; + float: right; + margin-right: 20px; + margin-top: 10px; + height: auto; + line-height: 30px; + font-size: 14px; + font-weight: 700; + margin-bottom: 20px; + color: #333; + .table-bottom-item { + width: 100%; + text-align: right; + .table-bottom-l { + width: 250px; + float: left; + } + .table-bottom-r { + width: calc(100% - 250px); + float: right; + } + } +} +::v-deep { + .iframe-dialog .el-dialog__body { + .basic-info { + overflow: hidden; + .basic-info-title { + background-color: #f4f8fe; + padding-left: 10px; + font-size: 15px; + font-weight: bold; + color: #666; + height: 42px; + line-height: 42px; + } + .basic-info-view { + margin-top: 10px; + padding-right: 40px; + .custom-name, + .common-select { + display: flex; + .common-select-sel { + width: 270px; + } + .common-select-btn { + margin-left: 5px; + font-size: 16px; + cursor: pointer; + } + } + } + .annex-view { + display: flex; + color: #6166d3; + .setFormat { + margin-left: 10px; + } + } + } + .unflod-collapse { + display: flex; + height: 30px; + justify-content: center; + align-items: center; + color: #6166d3; + } + .dialog-footer { + background-color: #f5f5f5; + height: 55px; + line-height: 55px; + } + } +} +</style> diff --git a/src/views/purchaseManage/purchase/components/AddPurchase2.vue b/src/views/purchaseManage/purchase/components/AddPurchase2.vue new file mode 100644 index 0000000..031cb3b --- /dev/null +++ b/src/views/purchaseManage/purchase/components/AddPurchase2.vue @@ -0,0 +1,536 @@ +<template> + <el-dialog + :close-on-click-modal="false" + :visible.sync="islook" + width="60rem" + class="add-event-dialog" + @close="shutdown" + > + <div slot="title" class="tac drawerHeader"> + <span>{{ editRow.id ? "缂栬緫" : "鍒涘缓" }}閲囪喘鍗�</span> + </div> + <div class="dialog-content-box"> + <div class="margin_bottom_20px font_size_14 title">鍩虹淇℃伅</div> + <el-form + ref="form" + :rules="rules" + :model="form" + label-width="120px" + label-position="left" + > + <el-form-item + label="閲囪喘绫诲瀷" + prop="brand" + class="form-item float_left" + > + <el-select + placeholder="璇烽�夋嫨閲囪喘绫诲瀷" + v-model="form.brand" + clearable + style="width: calc(100% - 30px)" + > + <el-option + v-for="ele in plcBrandList" + :key="ele.id" + :label="ele.name" + :value="ele.name" + ></el-option> + </el-select> + <i + class="el-icon-setting margin_left_10px cursor_pointer" + style="font-size: 20px; color: #333" + @click="handleShow" + ></i> + </el-form-item> + <el-form-item label="渚涘簲鍟嗗悕绉�" prop="returnNumber" class="form-item"> + <el-input + v-model="form.returnNumber" + maxlength="50" + clearable + placeholder="璇疯緭鍏�" + ></el-input> + </el-form-item> + <el-form-item label="鍗曟嵁鏉ユ簮" prop="returnName" class="form-item"> + <el-input + v-model="form.returnName" + maxlength="50" + clearable + placeholder="璇疯緭鍏�" + ></el-input> + </el-form-item> + <el-form-item label="閲囪喘鍗曞悕绉�" prop="returnName" class="form-item"> + <el-input + v-model="form.returnName" + maxlength="50" + clearable + placeholder="璇疯緭鍏�" + ></el-input> + </el-form-item> + <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="returnName" class="form-item"> + <el-input + v-model="form.returnName" + maxlength="50" + clearable + placeholder="璇疯緭鍏�" + ></el-input> + </el-form-item> + + <el-form-item label="鑱旂郴浜虹數璇�" prop="contact_phone" class="form-item"> + <el-input + v-model="form.contact_phone" + placeholder="璇疯緭鍏�" + maxlength="11" + show-word-limit + ></el-input> + </el-form-item> + <el-form-item label="绛剧害鏃ユ湡" prop="returnAt" class="form-item"> + <el-date-picker + v-model="form.returnAt" + style="width: 100%" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + <el-form-item label="浜や粯鏃ユ湡" prop="returnAt" class="form-item"> + <el-date-picker + v-model="form.returnAt" + style="width: 100%" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + <el-form-item label="澶囨敞淇℃伅" prop="remark" class="form-item-two"> + <el-input + type="textarea" + :autosize="{ minRows: 3, maxRows: 4 }" + maxlength="500" + clearable + v-model="form.remark" + ></el-input> + </el-form-item> + </el-form> + <div class="form-bottom-box"> + <div class="form-bottom-box-top"> + <div class="margin_bottom_2px font_size_14 title">浜у搧淇℃伅</div> + </div> + + <el-table + ref="multipleTable" + :header-cell-style="{ background: '#f1f3f8', color: '#000009' }" + :data="returnItems" + tooltip-effect="dark" + height="calc(100% - 80px)" + row-key="id" + border + style="width: 100%; padding: 0" + > + <el-table-column label="搴忓彿" type="index" width="80"> + </el-table-column> + <el-table-column label="宸ュ叿绫诲瀷" prop="toolType" width="120"> + <!-- <template slot-scope="scope"> + {{ scope.row.toolType }} + </template> --> + </el-table-column> + <el-table-column prop="toolNumber" label="宸ュ叿缂栫爜"> + </el-table-column> + <el-table-column prop="toolName" label="宸ュ叿鍚嶇О"> </el-table-column> + <el-table-column label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <el-button @click="deleteClick(scope)" type="text" size="small" + >绉婚櫎</el-button + > + </template> + </el-table-column> + </el-table> + <div class="font_size_14 margin_top_10px float_right"> + 褰掕繕鎬绘暟锛歿{ returnItems ? returnItems.length : 0 }} + </div> + </div> + </div> + <div slot="footer" class="dialog-footer tac"> + <el-button @click="shutdown">鍙栨秷</el-button> + + <el-button type="primary" @click="onSubmit(form)">纭畾</el-button> + </div> + <BomDialog + ref="editDialog" + @sucessSet="handleGetBomKindDictList" + @handleConfirmSave="handleConfirmSave" + :workList="plcBrandList" + title="PLC鍝佺墝" + ></BomDialog> + </el-dialog> +</template> + +<script> +import BomDialog from "@/views/purchaseManage/purchase/components/BomDialog"; +import { + postGetUnitDictList, + postGetSaveSUnitDict, +} from "@/api/purchaseManage/purchase"; +export default { + components: { + BomDialog, + }, + props: { + editRow: { + type: [Object], + default: () => { + return {}; + }, + }, + }, + data() { + return { + islook: false, + showWorkerList: [], + form: { + remark: "", + returnAt: "", + returnName: "", + returnNumber: "", + returnObj: "", + returnerId: "", + returnerName: "", + contact_phone: "", + }, + + rules: { + // 鎵嬫満鍙� + contact_phone: [ + { + required: true, + message: "璇峰~鍐�", + trigger: "change", + }, + { validator: this.validatorPhone, trigger: "change" }, + ], + // 棰嗙敤缂栧彿 + returnNumber: [ + { + required: true, + message: "璇峰~鍐�", + trigger: "change", + }, + ], + // 褰掕繕鍚嶇О + returnName: [ + { + required: true, + message: "璇峰~鍐�", + trigger: "change", + }, + ], + // 褰掕繕鏃堕棿 + returnAt: [ + { + required: true, + message: "璇烽�夋嫨", + trigger: "change", + }, + ], + // 褰掕繕浜� + returnObj: [ + { + required: true, + message: "璇烽�夋嫨", + trigger: "change", + }, + ], + }, + + returnItems: [], //瀛楀吀涓嬬殑琛ㄦ牸 + PreObj: { + pageSize: 0, + page: 0, + projectID: "", + }, + + // 鏌愪汉鐨勯鐢ㄦ槑缁� + toolsObj: { + takeName: "", + page: 1, + pageSize: 500, + takerId: "", + toolName: "", + toolType: "", + }, + plcBrandList: [], + }; + }, + mounted() {}, + watch: { + editRow(val) { + if (val.id && this.islook) { + this.initFormData(val); + } + }, + islook(val) { + if (val) { + this.returnItems = []; + this.form = { + remark: "", + returnAt: "", + returnName: "", + returnNumber: "", + returnerId: "", + returnerName: "", + returnObj: "", + contact_phone: "", + }; + + if (this.editRow && this.editRow.id) { + this.initFormData(this.editRow); + } + } + }, + }, + methods: { + validatorPhone(rule, value, callback) { + if (value) { + if (value == undefined || value == null) { + callback(new Error("璇疯緭鍏�")); + } else { + if (value.length != 11) { + callback(new Error("闀垮害鍦�11涓瓧绗︼紒")); + } else { + var reg = + /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/; + if (!reg.test(value)) { + callback(new Error("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽锛�")); + } else { + callback(); + } + } + } + } else { + callback(); + } + }, + // PLC閰嶇疆璁剧疆 + handleShow() { + this.handleGetBomKindDictList(); + this.$refs.editDialog.editDialogVisible = true; + }, + // PLC閰嶇疆 + handleGetBomKindDictList(val) { + postGetUnitDictList().then((res) => { + this.unitList = res.data; + if (val) { + for (let i in this.unitList) { + if (this.unitList[i].isDefault) { + this.form.unit = this.form.unit + ? this.form.unit + : this.unitList[i].name; + this.$set(this.form, "unit", this.form.unit); + break; + } + } + } + }); + }, + handleConfirmSave(data) { + postGetSaveSUnitDict({ data: data }).then((res) => { + if (res.code == 200) { + this.$message({ + message: "鎿嶄綔鎴愬姛锛�", + type: "success", + }); + this.$refs.editDialog.editDialogVisible = false; + this.handleGetBomKindDictList(); + } + }); + }, + returnChange(val) { + if (val) { + this.toolsObj.takerId = this.form.returnObj.split("&")[0]; + } else { + this.toolsObj.takerId = ""; + } + }, + + // 娣诲姞宸ュ叿 棰嗙敤鏄庣粏 + selectTools(frockType, selections) { + for (let i in selections) { + let isPush = true; + if (this.returnItems.length > 0) { + for (let j in this.returnItems) { + if (selections[i].id == this.returnItems[j].toolNumber) { + isPush = false; + } + } + } + + if (isPush) { + let toolName = ""; + if (frockType == "妯″叿") { + toolName = selections[i].moldName; + } else if (frockType == "妫�鍏�") { + toolName = selections[i].gaugeName; + } else { + toolName = selections[i].frockName; + } + let item = { + toolType: frockType, + toolNumber: selections[i].id, + toolName: toolName, + }; + this.returnItems.push(item); + } + } + }, + + initFormData(row) { + if (row.id) { + let form = JSON.parse(JSON.stringify(row)); + this.form = { + remark: form.remark, + returnAt: form.ReturnAt, + contact_phone: form.contact_phone, + returnName: form.ReturnName, + returnNumber: form.ReturnNumber, + returnerId: form.ReturnerId, + returnerName: form.ReturnerName, + returnObj: "", + id: row.id, + }; + + if (this.form.returnerId && this.form.returnerName) { + this.form.returnObj = + this.form.returnerId + "&" + this.form.returnerName; + } + this.returnItems = this.editRow.ReturnItems; + } + }, + + deleteClick(scope) { + this.returnItems.splice(scope.$index, 1); + this.$forceUpdate(); + this.$message({ + type: "success", + message: "绉婚櫎鎴愬姛锛�", + }); + }, + onSubmit() { + this.$refs.form.validate((valid) => { + if (valid) { + let params = JSON.parse(JSON.stringify(this.form)); + params.returnerId = params.returnObj.split("&")[0]; + params.returnerName = params.returnObj.split("&")[1]; + params.returnItems = this.returnItems; + if (this.editRow && this.editRow.id) { + params.id = this.editRow.id; + // editReturn(params).then((res) => { + // if (res.code == 200) { + // this.$message.success("缂栬緫鎴愬姛锛�"); + // this.$emit("shutdown", this.form); + // this.shutdown(); + // } + // }); + } else { + // addReturn(params).then((res) => { + // if (res.code == 200) { + // this.$message.success("娣诲姞鎴愬姛锛�"); + // this.$emit("shutdown", this.form); + // this.shutdown(); + // } + // }); + } + } + }); + }, + shutdown() { + this.islook = false; + this.$refs.form.resetFields(); + }, + }, +}; +</script> + +<style lang="scss" scoped> +::v-deep .el-tabs__content { + height: calc(100% - 55px); + overflow-y: auto; +} +.title { + height: 42px; + line-height:42px; + font-weight: 700px; + padding: 0 10px; + color: #333; + background: rgb(236, 244, 255); +} +.form-bottom-box { + height: calc(100% - 340px); + + .form-bottom-box-top { + height: 50px; + overflow: hidden; + } +} +.form-item { + width: calc(50% - 20px); + float: left; + &:nth-of-type(odd) { + margin-right: 20px; + } +} +.form-item-two { + width: 100%; + float: left; +} +.form-item-three { + width: calc(100% - 20px); + float: left; +} +.form-item-check { + width: calc(33% - 40px); + float: left; + &:nth-of-type(odd) { + margin-right: 20px; + } +} +.title { + width: 100%; +} +.dialog-content-box { + height: 580px; + padding-bottom: 50px; + overflow-y: auto; + + .el-form { + overflow: hidden; + padding: 0 10px; + } +} +.num-identify { + padding: 5px 8px; + background-color: rgba(255, 153, 0, 1); + border-radius: 6px; + font-size: 14px; + color: #fff; + font-weight: 600; +} +.drawerHeader { + // position:relative; + .identify { + width: 80px; + height: 25px; + line-height: 25px; + text-align: center; + border: 1px solid rgba(255, 153, 0, 1); + border-radius: 6px; + font-size: 16px; + color: rgba(255, 153, 0, 1); + transform: rotate(15deg); + font-weight: 600; + margin-right: 100px; + margin-top: 12px; + float: right; + } +} +</style> diff --git a/src/views/purchaseManage/purchase/components/BomDialog.vue b/src/views/purchaseManage/purchase/components/BomDialog.vue new file mode 100644 index 0000000..3a302b6 --- /dev/null +++ b/src/views/purchaseManage/purchase/components/BomDialog.vue @@ -0,0 +1,272 @@ +<template> + <el-dialog + :close-on-click-modal="false" + :visible.sync="editDialogVisible" + width="623px" + class="add-event-dialog" + @close="shutdown" + > + <div slot="title" class="tac drawerHeader"> + <span> {{title}}缁勪欢</span> + </div> + + <div class="dialog-content-box"> + <el-table + v-if="isTableShow" + :header-cell-style="{ background: '#f1f3f8', color: '#000009' }" + ref="multipleTable" + :data="BomTableData" + height="100%" + tooltip-effect="dark" + > + <el-table-column prop="unit" label="绫诲埆"> + <template slot-scope="scope"> + <el-input v-model="scope.row.name"></el-input> + </template> + </el-table-column> + <el-table-column prop="createdAt" label="璁句负榛樿"> + <template slot-scope="scope"> + <el-switch @change="switchChange(scope,scope.row.isDefault)" v-model="scope.row.isDefault"></el-switch> + </template> + + </el-table-column> + <el-table-column label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <!-- <i class="el-icon-top" id="iconStyle"></i> + <i class="el-icon-bottom" id="iconStyle"></i> --> + <i class="el-icon-delete" id="iconStyle" @click="handleDelete(scope)"></i> + </template> + </el-table-column> + </el-table> + </div> + <div slot="footer" class="drawerFooter"> + <el-button + @click="handleAdd()" + style="margin-left: 16px; color: #fff; background-color: #ee790c" + >鏂板</el-button + > + <el-button @click="shutdown">鍙栨秷</el-button + ><el-button + type="primary" + @click="handleConfirmSave()" + style="margin-left: 16px; color: #fff; background-color: #2a78fb" + >纭畾</el-button + > + </div> + + </el-dialog> +</template> + +<script> + + +export default { + props: { + title:{ + type:String, + }, + editRow: { + type: Object, + default: () => { + return {}; + }, + }, + workList:{ + type:Array, + } + }, + data() { + return { + editDialogVisible: false, + isTableShow:true, + form: {}, + BomTableData: [1], + work: 1, + flag: "add", + Tabs: "msg", + tableData: [ + { + date: "PEBU", + name: "PE甯�", + number: "21", + unit: "鍚�", + }, + ], + rules: { + id: [{ required: true, message: "璇疯緭鍏ョ墿鏂欑紪鐮�", trigger: "blur" }], + name: [ + { required: true, message: "璇疯緭鍏ョ墿鏂欏悕绉�", trigger: "blur" }, + + ], + specs: [{ required: true, message: "璇疯緭鍏ョ墿鏂欒鏍�", trigger: "blur" }], + type: [{ required: true, message: "璇疯緭鍏ョ墿鏂欏瀷鍙�", trigger: "blur" }], + amount: [ + { + required: true, + message: "璇疯緭鍏ユ暟閲�", + trigger: "blur", + }, + ], + unit: [ + { + required: true, + message: "璇疯緭鍏ュ崟浣�", + trigger: "blur", + }, + ], + model: [ + { required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }, + ], + }, + }; + }, + watch: { + editDialogVisible(newVal){ + if(newVal){ + this.BomTableData= JSON.parse( + JSON.stringify(this.workList)) + } + }, + workList(){ + this.BomTableData=JSON.parse( + JSON.stringify(this.workList)) + } + }, + mounted() { + }, + methods: { + handleAdd() { + this.BomTableData.push({name:'',isDefault:false}); + }, + handleDelete(scope) { + this.BomTableData.splice(scope.$index,1) + // this.BomTableData=this.BomTableData.filter(i=>{ + // return i.id!=id + // }) + + }, + switchChange(scope,val){ + let arr=[] + for(let i in this.BomTableData){ + if(this.BomTableData[i].isDefault){ + arr.push(i) + } + } + if(arr.length>1){ + this.$message({ + message: '鍙兘璁句竴涓负榛樿', + type: "warning", + }); + scope.row.isDefault=!val + } + }, + handleConfirmSave() { + let arr=[] + for(let i in this.BomTableData){ + if(this.BomTableData[i].isDefault){ + arr.push(i) + } + } + if(arr.length>1){ + this.$message({ + message: '鍙兘璁句竴涓负榛樿', + type: "warning", + }); + }else{ + this.$emit('handleConfirmSave',this.BomTableData) + } + }, + + shutdown() { + this.editDialogVisible = false; + + }, + }, +}; +</script> + +<style lang="scss" scoped> +.dialog-content-box { + height:400px; + .form-item { + width: 65%; + } + .form-item2 { + width: calc(50% - 5px); + float:left; + + } +} + #iconStyle { + font-size: 20px !important; + } + + +::v-deep .el-form { + width: 389px; + .input-box .input-content input { + margin: 0; + margin-right: 3px; + } + .el-input__inner, + .el-textarea__inner { + line-height: 18px; + font-family: PingFangSC; + } +} +::v-deep .el-tabs__header { + border: none; + .el-tabs__nav { + border: none; + + } +} +::v-deep .el-form-item__content { + width: 263px; + .input-box { + width: 263px; + } +} +::v-deep .el-form-item__label { + font-size: 13px !important; + color: #000; + font-family: PingFangSC; + text-align: center !important; + width: 60px; +} +::v-deep .input-box .input-content input { + width: 23px; + height: 26px; + border-color: rgba(0, 0, 0, 0.1); + font-family: PingFangSC; +} +::v-deep .el-icon-minus { + width: 13px !important; + height: 26px !important; + line-height: 38px !important; + color: #e5e5e5; + font-size: 13px; +} +::v-deep .el-input__inner { + font-size: 13px !important; + color: rgba(0, 0, 0, 0.9); +} +::v-deep .el-input__inner::placeholder { + color: rgba(0, 0, 0, 0.4); +} +::v-deep .el-form-item__error { + font-family: PingFangSC; +} +.self { + ::v-deep .el-input__inner { + } +} +::v-deep .el-select-dropdown { + position: absolute !important; + top: 36px !important; + left: 0px !important; +} +::v-deep .el-select-dropdown__wrap { + overflow: auto !important; +} +</style> diff --git a/src/views/purchaseManage/purchase/components/SelectClientDialog.vue b/src/views/purchaseManage/purchase/components/SelectClientDialog.vue new file mode 100644 index 0000000..ae0c94c --- /dev/null +++ b/src/views/purchaseManage/purchase/components/SelectClientDialog.vue @@ -0,0 +1,192 @@ +<template> + <div class="edit-selClient-box"> + <el-dialog + :title="'瀹㈡埛绠$悊'" + :visible.sync="editConfig.editVisible" + :width="dialogWidth" + :before-close="handleClose" + :append-to-body="true" + :close-on-click-modal="false" + > + <div class="bg-view"> + <div class="query-bg"> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + /> + <div class="btn"> + <!-- <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> + <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> --> + </div> + </div> + <TableCommonView + ref="tableListRef" + v-loading="loading" + :table-list="tableList" + :select-box="false" + @selCommonClick="selNameClick" + > + </TableCommonView> + <div slot="footer" class="dialog-footer"> + <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> + </div> + </div> + </el-dialog> + </div> +</template> + +<script> +import { + getClientList +} from "@/api/purchaseManage/purchase"; +export default { + name: "EditSelClientDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + editVisible: false, + title: "", + infomation: {} + } + } + } + }, + components: {}, + computed: {}, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + queryInput: "", + select: "1", + tableData: [], + searchSelOptions: [], + loading: false, + searchOptions: [], + tableList: {}, + search_map: {} + } + }, + created() { + this.setTable() + this.getData() + }, + methods: { + setTable() { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100, isClick: true }, + { label: "瀹㈡埛缂栧彿", prop: "number" }, + { label: "瀹㈡埛鐘舵��", prop: "client_status" }, + { label: "閿�鍞礋璐d汉", prop: "member_name", min: 100 }, + { label: "娉曞畾浠h〃浜�", prop: "representative", min: 100 }, + { label: "娉ㄥ唽鏃堕棿", prop: "registration_time" }, + { label: "缁忚惀鑼冨洿", prop: "business_scope" }, + { label: "璇︾粏鍦板潃", prop: "detail_address" }, + { label: "澶囨敞", prop: "remark" } + ] + } + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, + handleClose() { + this.editConfig.editVisible = false + }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + await getClientList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }) + .then((res) => { + console.log(res) + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + client_status: item.client_status.name, + member_name: item.member.username + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } else { + this.tableList.tableInfomation = [] + } + this.loading = false + }) + .catch((err) => { + console.log(err) + this.this.tableList.tableInfomation = [] + this.loading = false + }) + }, + selNameClick(row) { + this.editConfig.editVisible = false + this.$emit("selClient", row) + }, + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content + } + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.bg-view { + margin: 10px; + .query-bg { + margin-left: -20px; + margin-bottom: 10px; + display: flex; + justify-content: space-between; + .el-input { + width: 310px; + .el-select { + width: 100px; + } + } + .btn { + float: right; + } + } +} +.sel-name { + color: $color-primary; + cursor: pointer; +} +.dialog-footer { + height: 40px; + line-height: 40px; + color: red; +} +::v-deep { + .input-with-select .el-input-group__prepend { + background-color: #fff; + } +} +</style> diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue index 52a58c6..6d1b7f3 100644 --- a/src/views/purchaseManage/purchase/index.vue +++ b/src/views/purchaseManage/purchase/index.vue @@ -23,7 +23,7 @@ <template slot="tableButton"> <el-table-column label="鎿嶄綔" width="120" fixed="right"> <template slot-scope="scope"> - <el-button type="text" size="small" @click="editClick" style="margin-right: 5px" + <el-button type="text" size="small" @click="editClick(scope.row)" style="margin-right: 5px" >缂栬緫</el-button > <el-button @click="submitClick(scope.row)" type="text" size="small">鎻愪氦</el-button> @@ -41,18 +41,24 @@ <!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> --> <!-- 璇︽儏 --> <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" @submitClick="submitClick" /> + <AddPurchase2 ref="add" :editRow="editRow" @shutdown="getData" /> + <!-- 鏂板缓/缂栬緫 --> + <AddPurchase v-if="editConfig.visible" :edit-common-config="editConfig" /> </div> </template> <script> import pageMixin from "@/components/makepager/pager/mixin/pageMixin" -import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead" +import { + getSalesLeadsList, getDeleteSalesLeads +} from "@/api/purchaseManage/purchase"; import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier" - +import AddPurchase2 from "@/views/purchaseManage/purchase/components/AddPurchase2" +import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase" export default { name: "SupplierManage", props: {}, - components: { DetailSupplier }, + components: { DetailSupplier,AddPurchase2,AddPurchase }, mixins: [pageMixin], computed: {}, data() { @@ -63,7 +69,13 @@ visible: false, infomation: {} }, - search_map: {} + search_map: {}, + editRow:{}, + editConfig: { + visible: false, + title: "鍒涘缓", + infomation: {} + }, } }, created() { @@ -125,10 +137,21 @@ this.getData() }, // 鏂板缓 - addBtnClick() {}, + addBtnClick() { + // this.editRow = {}; + // this.$refs.add.islook = true; + this.editConfig.visible = true + this.editConfig.title = "鍒涘缓" + this.editConfig.infomation = { } + }, + // 缂栬緫 - editClick(){ - + editClick(row){ + // this.editRow = row; + // this.$refs.add.islook = true; + this.editConfig.visible = true + this.editConfig.title = "缂栬緫" + this.editConfig.infomation = { ...row } }, // 纭鍙戣揣 submitClick() { -- Gitblit v1.8.0