明细单添加编辑接口+编辑产品列表赋值逻辑修改+查看时限制操作的方法逻辑修改+毛利毛利率计算给列表赋值
| | |
| | | ></el-input-number> |
| | | </el-form-item> |
| | | <span v-else> |
| | | <template v-if="pageName=='quotation'&&item.prop=='profit'"> |
| | | {{ (scope.row.price&&scope.row.cost)?Number(scope.row.price)-Number(scope.row.cost):'' }} |
| | | </template> |
| | | <template v-if="pageName=='quotation'&&item.prop=='margin'"> |
| | | {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2):'' }} |
| | | </template> |
| | | <template v-else> |
| | | <template> |
| | | {{ scope.row[item.prop] }} |
| | | </template> |
| | | </span> |
| | |
| | | <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="40" align="center"> |
| | | <el-table-column label="操作" width="40" v-if="!detailEnter" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | type="text" |
| | |
| | | /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; |
| | | if (!reg2.test(value)||value==0) { |
| | | this.$message.error("成本单价需要填写大于0的2位小数!") |
| | | return true; |
| | | } |
| | | this.$forceUpdate() |
| | | } |
| | | this.$emit("inputContent", val, prop, row) |
| | | if(this.pageName=='quotation'){ |
| | | if(prop=='price'||prop=='cost'){ |
| | | if(scope.row.price&&scope.row.cost){ |
| | | let profit=Number(scope.row.price)-Number(scope.row.cost) |
| | | scope.row.profit=profit+''; |
| | | let margin=((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2) |
| | | scope.row.margin=margin+''; |
| | | } |
| | | } |
| | | } |
| | | this.$emit("inputContent", val, prop, row,scope) |
| | | }, |
| | | // 清空 |
| | | empty() { |
| | |
| | | deleteClick(scope){ |
| | | this.tableList.tableData.splice(scope.$index,1) |
| | | this.$forceUpdate(); |
| | | this.$message.success('删除除成功!') |
| | | this.$message.success('删除成功!') |
| | | this.$emit("deleteClick",scope) |
| | | }, |
| | | // 重算 |
| | |
| | | <!-- :detail-enter="true" --> |
| | | <CommonFormTableView |
| | | ref="commonFormTableView" |
| | | :detail-enter="isView?true:false" |
| | | :selectBox="false" |
| | | :show-summary="showSummary" |
| | | pageName="quotation" |
| | | :isOperate="((autoCodeHeadersObj.bjd=='yes'&&editConfig.infomation.quotation_number)||autoCodeHeadersObj.bjd!='yes')?true:false" |
| | |
| | | quotationId: this.editCommonConfig.infomation.quotationId, |
| | | tableData: [], |
| | | isView: this.editCommonConfig.title === "查看", |
| | | selectBox: this.editCommonConfig.title !== "查看", |
| | | thatMember: {} |
| | | } |
| | | }, |
| | |
| | | console.log(res) |
| | | this.quotationList = res.data.list |
| | | if (value === "全部产品") { |
| | | this.quotationList.map((item) => { |
| | | if (item.id === this.editConfig.infomation.quotationId) { |
| | | this.tableData = item.products |
| | | this.tableData.map((item, index) => { |
| | | item.productId = index + 1 |
| | | this.tableData.forEach((key) => { |
| | | if (item.number === key.number) { |
| | | item.amount = key.amount |
| | | item.id = key.id |
| | | } |
| | | }) |
| | | }) |
| | | this.productTableList.tableData = this.tableData |
| | | } |
| | | }) |
| | | // this.quotationList.map((item) => { |
| | | // if (item.id === this.editConfig.infomation.quotationId) { |
| | | |
| | | // this.tableData.map((item, index) => { |
| | | // item.productId = index + 1 |
| | | // this.tableData.forEach((key) => { |
| | | // if (item.number === key.number) { |
| | | // item.amount = key.amount |
| | | // item.id = key.id |
| | | // } |
| | | // }) |
| | | // }) |
| | | |
| | | // } |
| | | // }) |
| | | } |
| | | } |
| | | }) |
| | |
| | | ] |
| | | } else { |
| | | this.tableData = this.editConfig.infomation.products |
| | | this.tableData.map((item, index) => { |
| | | item.productId = index + 1 |
| | | }) |
| | | this.getQuotation(this.editConfig.infomation.saleChanceId, "全部产品") |
| | | } |
| | | // let productData = this.quotationList.products |
| | |
| | | }, |
| | | // 查看 编辑 |
| | | handleClick(row, title) { |
| | | console.log(row, title) |
| | | this.editConfig.visible = true |
| | | let params = JSON.parse(JSON.stringify(row)); |
| | | this.editConfig.title = title |
| | | this.editConfig.infomation = { |
| | | ...row, |
| | | ...params, |
| | | currency: "人民币", |
| | | sale_chance_name: row.saleChance.name, |
| | | deliverType: row.deliverType === 0 ? "" : row.deliverType, |
| | | quotation_number: row.quotation.number |
| | | sale_chance_name: params.saleChance.name, |
| | | deliverType: params.deliverType === 0 ? "" : params.deliverType, |
| | | quotation_number: params.quotation.number |
| | | } |
| | | this.editConfig.visible = true |
| | | }, |
| | | // 确认提交 |
| | | async submitClick(row) { |