|
@ -5,15 +5,16 @@ |
|
|
<el-button type="primary" @click="openDialog">新增</el-button> |
|
|
<el-button type="primary" @click="openDialog">新增</el-button> |
|
|
|
|
|
|
|
|
<GuipDialog :dialogVisible="dialogVisible" :title="dialogTitle" :show-close-button="false" |
|
|
<GuipDialog :dialogVisible="dialogVisible" :title="dialogTitle" :show-close-button="false" |
|
|
:show-cancel-button="showCancelButton" @confirm="handleConfirm" @cancel="handleCancel" @close="handleClose" |
|
|
:show-cancel-button="showCancelButton" @confirm="handleConfirm" @cancel="handleCancel" |
|
|
|
|
|
@close="handleClose" |
|
|
@dialogVisibleChange="dialogVisibleChange"> |
|
|
@dialogVisibleChange="dialogVisibleChange"> |
|
|
<el-form :model="form" class="el-row demo-ruleForm" ref="formRef"> |
|
|
<el-form :model="form" class="el-row demo-ruleForm" ref="formRef"> |
|
|
<el-form-item label="检测类型" prop="type"> |
|
|
<el-form-item label="检测类型" prop="type"> |
|
|
<GuipSelect v-model="form.type" :options="type2nameOptions" :defaultValue="form.typename" /> |
|
|
<GuipSelect v-model="form.type" :options="type2nameOptions" :defaultValue="form.typename"/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="采购单价" prop="type" label-width="73px"> |
|
|
<el-form-item label="采购单价" prop="type" label-width="73px"> |
|
|
<div style="display: flex; align-items: center; gap: 8px; width: 100%;"> |
|
|
<div style="display: flex; align-items: center; gap: 8px; width: 100%;"> |
|
|
<GuipInput v-model="form.unit_price" style="flex: 1;" :default-value="form.unit_price" /> |
|
|
<GuipInput v-model="form.unit_price" style="flex: 1;" :default-value="form.unit_price"/> |
|
|
<span>元 /</span> |
|
|
<span>元 /</span> |
|
|
<GuipInput v-model="form.unit_num" style="flex: 1;" :default-value="form.unit_num"/> |
|
|
<GuipInput v-model="form.unit_num" style="flex: 1;" :default-value="form.unit_num"/> |
|
|
<span>字(篇/页)</span> |
|
|
<span>字(篇/页)</span> |
|
@ -28,8 +29,10 @@ |
|
|
</div> |
|
|
</div> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="起止日期" prop="type" label-width="73px"> |
|
|
<el-form-item label="起止日期" prop="type" label-width="73px"> |
|
|
<el-date-picker v-model="form.date" type="daterange" range-separator="至" start-placeholder="开始日期" |
|
|
<el-date-picker v-model="form.date" type="daterange" range-separator="至" |
|
|
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" style="width: 100%;" :default-value="form.date"> |
|
|
start-placeholder="开始日期" |
|
|
|
|
|
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
|
|
style="width: 100%;" :default-value="form.date"> |
|
|
</el-date-picker> |
|
|
</el-date-picker> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</template> |
|
|
</template> |
|
@ -40,7 +43,12 @@ |
|
|
<el-form> |
|
|
<el-form> |
|
|
<el-table :data="tableData" style="width: 100%"> |
|
|
<el-table :data="tableData" style="width: 100%"> |
|
|
<template v-if="type == 'purchase'"> |
|
|
<template v-if="type == 'purchase'"> |
|
|
<el-table-column label="检测类型"> |
|
|
<el-table-column prop="type"> |
|
|
|
|
|
<template slot="header"> |
|
|
|
|
|
<GuipSelect class="custom-select" v-model="chktype" :options="type2nameOptions" |
|
|
|
|
|
defaultValue="检测类型" @change="changeSelectType"/> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
{{ type2name[scope.row.type] }} |
|
|
{{ type2name[scope.row.type] }} |
|
|
</template> |
|
|
</template> |
|
@ -60,7 +68,12 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<template v-else> |
|
|
<template v-else> |
|
|
<el-table-column label="检测类型"> |
|
|
<el-table-column prop="type"> |
|
|
|
|
|
<template slot="header"> |
|
|
|
|
|
<GuipSelect class="custom-select" v-model="chktype" :options="type2nameOptions" |
|
|
|
|
|
defaultValue="检测类型" @change="changeSelectType"/> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
{{ type2name[scope.row.type] }} |
|
|
{{ type2name[scope.row.type] }} |
|
|
</template> |
|
|
</template> |
|
@ -132,7 +145,8 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
chktype:0, |
|
|
id: 0, |
|
|
|
|
|
chktype: 0, |
|
|
currentPage: 1, //当前页 |
|
|
currentPage: 1, //当前页 |
|
|
pageSize: 5, //每页的容量 |
|
|
pageSize: 5, //每页的容量 |
|
|
total: 0, //列表总数 |
|
|
total: 0, //列表总数 |
|
@ -188,6 +202,9 @@ export default { |
|
|
this.getStagePurchase() |
|
|
this.getStagePurchase() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
changeSelectType() { |
|
|
|
|
|
this.init() |
|
|
|
|
|
}, |
|
|
getPurchase() { |
|
|
getPurchase() { |
|
|
const that = this |
|
|
const that = this |
|
|
that.tableData = [] |
|
|
that.tableData = [] |
|
@ -240,12 +257,12 @@ export default { |
|
|
handleConfirm() { |
|
|
handleConfirm() { |
|
|
console.log('提交成功:', this.form); |
|
|
console.log('提交成功:', this.form); |
|
|
const that = this |
|
|
const that = this |
|
|
if(!that.form.type){ |
|
|
if (!that.form.type) { |
|
|
this.$message.warning('请选择检测类型'); |
|
|
this.$message.warning('请选择检测类型'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if(that.type == 'purchase'){ |
|
|
if (that.type == 'purchase') { |
|
|
if(!that.form.unit_price || !that.form.unit_num){ |
|
|
if (!that.form.unit_price || !that.form.unit_num) { |
|
|
this.$message.warning('请输入采购单价'); |
|
|
this.$message.warning('请输入采购单价'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -256,7 +273,7 @@ export default { |
|
|
unit_num: that.form.unit_num, |
|
|
unit_num: that.form.unit_num, |
|
|
}).then(response => { |
|
|
}).then(response => { |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
if(!response.status){ |
|
|
if (!response.status) { |
|
|
this.$message.warning(response.info); |
|
|
this.$message.warning(response.info); |
|
|
} |
|
|
} |
|
|
this.dialogVisible = false; |
|
|
this.dialogVisible = false; |
|
@ -265,13 +282,13 @@ export default { |
|
|
this.$message.warning(error); |
|
|
this.$message.warning(error); |
|
|
this.dialogVisible = false; |
|
|
this.dialogVisible = false; |
|
|
}) |
|
|
}) |
|
|
}else{ |
|
|
} else { |
|
|
if((!that.form.unit_price || !that.form.unit_num) && !that.form.cost){ |
|
|
if ((!that.form.unit_price || !that.form.unit_num) && !that.form.cost) { |
|
|
this.$message.warning('请输入采购单价或阶段成本'); |
|
|
this.$message.warning('请输入采购单价或阶段成本'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(!that.form.sdate || !that.form.edate){ |
|
|
if (!that.form.sdate || !that.form.edate) { |
|
|
this.$message.warning('请选择起止日期'); |
|
|
this.$message.warning('请选择起止日期'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -285,7 +302,7 @@ export default { |
|
|
edate: that.form.edate, |
|
|
edate: that.form.edate, |
|
|
}).then(response => { |
|
|
}).then(response => { |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
if(!response.status){ |
|
|
if (!response.status) { |
|
|
this.$message.warning(response.info); |
|
|
this.$message.warning(response.info); |
|
|
} |
|
|
} |
|
|
this.dialogVisible = false; |
|
|
this.dialogVisible = false; |
|
@ -316,14 +333,16 @@ export default { |
|
|
const D = pad(date.getDate()); |
|
|
const D = pad(date.getDate()); |
|
|
return `${Y}-${M}-${D}`; |
|
|
return `${Y}-${M}-${D}`; |
|
|
}, |
|
|
}, |
|
|
editPurchase(row){ |
|
|
editPurchase(row) { |
|
|
|
|
|
this.form.id = row.id |
|
|
this.form.type = row.type |
|
|
this.form.type = row.type |
|
|
this.form.typename = this.type2name[row.type] |
|
|
this.form.typename = this.type2name[row.type] |
|
|
this.form.unit_price = row.unit_price |
|
|
this.form.unit_price = row.unit_price |
|
|
this.form.unit_num = row.unit_num |
|
|
this.form.unit_num = row.unit_num |
|
|
this.dialogVisible = true; |
|
|
this.dialogVisible = true; |
|
|
}, |
|
|
}, |
|
|
editStagePurchase(row){ |
|
|
editStagePurchase(row) { |
|
|
|
|
|
this.form.id = row.id |
|
|
this.form.type = row.type |
|
|
this.form.type = row.type |
|
|
this.form.typename = this.type2name[row.type] |
|
|
this.form.typename = this.type2name[row.type] |
|
|
this.form.unit_price = row.unit_price |
|
|
this.form.unit_price = row.unit_price |
|
@ -334,4 +353,7 @@ export default { |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
<style scoped lang="scss"> |
|
|
<style scoped lang="scss"> |
|
|
|
|
|
.custom-select { |
|
|
|
|
|
width: 200px; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |