diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl
index 043e07c..c4775ce 100644
--- a/src/main/resources/templates/admin/business/process-edit.ftl
+++ b/src/main/resources/templates/admin/business/process-edit.ftl
@@ -48,6 +48,14 @@
display: none;
}
+ .el-table .warning-row {
+ background: oldlace;
+ }
+
+ .el-table .child-row {
+ background: #f0f9eb;
+ }
+
@@ -87,18 +95,18 @@
- {{processForm.projectType}}
+ {{processForm.projectTypeDesc}}
- {{processForm.cooperationType}}
+ {{processForm.cooperationTypeDesc}}
-
+
@@ -189,14 +197,14 @@
-
+
-
+
@@ -245,7 +253,7 @@
-
+
@@ -261,7 +269,7 @@
-
+
@@ -322,13 +330,13 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -346,42 +354,98 @@
- <#-- 选择 业务采购清单明细 -->
+ <#-- 业务采购清单明细 -->
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{scope.row.parent.amountCurrent}}
+
+
+
+
+
+
+ {{scope.row.amount - scope.row.amountAlready}}
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
返回上一级
- 保存并返回上一级
+ 保存并返回上一级
@@ -433,6 +497,9 @@
// 销售合同收入明细
incomeDetails: [],
supplierMaterialsForm: [],
+ procurementDetailsRowKey: 0,
+ procurementDetails: [],
+ filteredProcurementDetails: [],
}
}
@@ -450,8 +517,36 @@
},
goToProcurementContract() {
- this.changeMode(saleContractProcess)
+ this.changeMode(procurementContractProcess)
+ this.processType = procurementContract
},
+
+ /**
+ * 校验不通过提示
+ * @returns {boolean} 校验通过否
+ */
+ checkProcurementDetails() {
+ const emptyRows = this.procurementDetails.filter(detail => {
+ return isNotEmpty(procurementDetailProperties.filter(property => isBlank(detail[property])))
+ })
+ console.log(emptyRows)
+ if (isNotEmpty(emptyRows)) {
+ const row = emptyRows[0]
+ this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写")
+ return false
+ }
+ return true
+ },
+ /**
+ * 保存 业务采购合同清单明细,并验证表单是否填写完整,
+ * 如果完整就到流程表单界面
+ */
+ saveProcurementContractDetail() {
+ if (this.checkProcurementDetails()) {
+ this.goToProcurementContract()
+ }
+ },
+
goToContractDetail() {
const { projectId } = this.processForm
if (projectId) {
@@ -487,10 +582,10 @@
fetch("${base}/process/" + id)
.then(res => res.json())
.then(data => {
- const { incomeDetails, process, contract, ...form } = data
+ const { incomeDetails, process, contract, procurementDetails, attachments, ...form } = data
// 转换数据
// @formatter:off
- const computeType = (type) => {
+ const computeType = type => {
switch (type) {
case 1: return '设备'
case 2: return '工程'
@@ -498,19 +593,49 @@
default: return '未知'
}
}
+ const computeFeeType = type => {
+ switch (type) {
+ case 1: return '设备'
+ case 2: return '施工'
+ case 3: return '服务'
+ case 4: return '其他'
+ default: return '未知'
+ }
+ }
// @formatter:on
- const applyDeptId = process.applyDept.split(',')
+ const applyDeptId = process.applyDeptId.split(',')
this.initForm({ ...form, ...process, ...contract, applyDeptId })
this.projectSelected = true
this.processType = process.processType
- this.incomeDetails = incomeDetails.map(detail => ({
+ this.incomeDetails = incomeDetails && incomeDetails.map(detail => ({
...detail, type: computeType(detail.type)
}))
- this.fileList = JSON.parse(process.attachmentUri).map(item => ({
+
+ this.fileList = attachments.map(item => ({
name: item.name, url: item.uri
}))
+ let rowKey = 0
+
+ function mapChildren(detail) {
+ const { purchaseDetails } = detail
+ return (purchaseDetails || []).map(purchase => ({
+ ...purchase, ...detail, rowKey: rowKey++, feeType: computeFeeType(detail.type),
+ totalTaxInclude_: detail.totalTaxInclude, totalTaxInclude: undefined, // 存在相同字段转换一下
+ isUnderwritten: detail.isUnderwritten === 1 ? "是" : "否",
+ }))
+ }
+
+ this.procurementDetails = procurementDetails && procurementDetails.map(detail => ({
+ ...detail, feeType: computeFeeType(detail.type),
+ totalTaxInclude_: detail.totalTaxInclude, totalTaxInclude: undefined, // 存在相同字段转换一下
+ isUnderwritten: detail.isUnderwritten === 1 ? "是" : "否",
+ rowKey: rowKey++, children: mapChildren(detail)
+ }))
+
+ this.procurementDetailsRowKey = rowKey
+
if (process.processType === 'sale_contract') {
this.changeMode(saleContractProcess)
}
@@ -520,7 +645,7 @@
})
.catch(err => {
- this.$message.error("项目'" + name + "'加载失败");
+ this.$message.error("项目加载失败");
})
.finally(() => loading.close())
},
@@ -687,6 +812,41 @@
this.supplierMaterialsForm.push({})
},
+ addProcurementDetailRow(scope) {
+ const { row } = scope
+ const { children } = row
+ const newRow = {
+ ...row,
+ rowKey: this.procurementDetailsRowKey++,
+ newRow: true,
+ parent: row // 记录上一级元素,在删除的时候使用
+ }
+
+ delete newRow['children']
+ if (children) {
+ row['children'].push(newRow)
+ }
+ else {
+ row['children'] = [newRow]
+ }
+
+ scope.store.table.toggleRowExpansion(row, true)
+ },
+
+ removeProcurementDetailRow(scope) {
+ const { rowKey, parent } = scope.row
+ parent.children = parent.children.filter(child => child.rowKey !== rowKey)
+ },
+
+ // 区别子项
+ procurementDetailRowClassName({ row, rowIndex }) {
+ if (row.parent) {
+ // 有父项说明就是子项
+ return 'child-row';
+ }
+ return '';
+ },
+
applyDeptSelected(value) {
if (value.length === 0) {
this.processForm['applyDept'] = null
@@ -759,7 +919,9 @@
case saleContractProcess:
return "编辑销售合同流程"
case saleContractDetail:
- return "销售合同清单明细"
+ return "编辑销售合同清单明细"
+ case procurementContractDetail:
+ return "编辑业务采购合同清单明细"
case newBusinessProcurementContractProcess:
return "编辑业务采购合同流程"
}