Browse Source

采购价页面渲染

pull/11/head
pengda 3 weeks ago
parent
commit
3442e39e3b
  1. 18
      src/components/GuipSelect.vue
  2. 90
      src/views/super/Ranking/Purchase.vue

18
src/components/GuipSelect.vue

@ -46,15 +46,15 @@ export default {
this.placeholder1 = this.placeholder;
}
this.$nextTick(() => {
let els = document.querySelectorAll('.el-select .el-input');
els.forEach(item => {
item.onmouseover = function () {
item.classList.add("hoverclass")
}
item.onmouseout = function () {
item.classList.remove("hoverclass")
}
})
// let els = document.querySelectorAll('.el-select .el-input');
// els.forEach(item => {
// item.onmouseover = function () {
// item.classList.add("hoverclass")
// }
// item.onmouseout = function () {
// item.classList.remove("hoverclass")
// }
// })
})
},
methods: {

90
src/views/super/Ranking/Purchase.vue

@ -10,7 +10,8 @@
@dialogVisibleChange="dialogVisibleChange">
<el-form :model="form" class="el-row demo-ruleForm" ref="formRef">
<el-form-item label="检测类型" prop="type">
<GuipSelect v-model="form.type" :options="type2nameOptions" :defaultValue="form.typename"/>
<GuipSelect v-model="form.type" :options="type2nameOptions"
:defaultValue="type2name[form.type]"/>
</el-form-item>
<el-form-item label="采购单价" prop="type" label-width="73px">
<div style="display: flex; align-items: center; gap: 8px; width: 100%;">
@ -28,7 +29,7 @@
<span></span>
</div>
</el-form-item>
<el-form-item label="起止日期" prop="type" label-width="73px">
<el-form-item label="起止日期" prop="date" label-width="73px">
<el-date-picker v-model="form.date" type="daterange" range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss"
@ -39,7 +40,7 @@
</el-form>
</GuipDialog>
</div>
<div class=" flex-common">
<div class=" flex-common" v-if="type2nameOptions.length > 0">
<el-form>
<el-table :data="tableData" style="width: 100%">
<template v-if="type == 'purchase'">
@ -56,13 +57,14 @@
<el-table-column label="采购单价">
<template slot-scope="scope">
{{ scope.row.unit_price }} / {{ scope.row.unit_num==1 ? '篇' : scope.row.unit_num + '字' }}
{{ scope.row.unit_price }} / {{
scope.row.unit_num == 1 ? '篇' : scope.row.unit_num + '字' }}
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<a @click="editPurchase(scope.row)" style="color: #006aff">编辑</a>
<a @click="editPurchase(scope.row)" style="color: #006aff;cursor: pointer;">编辑</a>
</template>
</el-table-column>
</template>
@ -82,7 +84,8 @@
<el-table-column label="采购价">
<template slot-scope="scope">
<template v-if="scope.row.unit_price>0">
单价{{ scope.row.unit_price }} / {{ scope.row.unit_num==1 ? '篇' : scope.row.unit_num + '字' }}
单价{{ scope.row.unit_price }} / {{
scope.row.unit_num == 1 ? '篇' : scope.row.unit_num + '字' }}
</template>
<template v-else>
成本{{ scope.row.cost }}
@ -98,7 +101,10 @@
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<a @click="editStagePurchase(scope.row)" style="color: #006aff">编辑</a>
<a @click="editStagePurchase(scope.row)"
style="color: #006aff;cursor: pointer;">编辑</a>
<a v-if="scope.row.is_sync == 0" @click="syncStagePurchase(scope.row)"
style="color: #006aff;margin-left: 20px;cursor: pointer;">同步</a>
</template>
</el-table-column>
</template>
@ -148,7 +154,7 @@ export default {
id: 0,
chktype: 0,
currentPage: 1, //
pageSize: 5, //
pageSize: 20, //
total: 0, //
tableData: [],
type2name: [],
@ -157,11 +163,12 @@ export default {
showCancelButton: true, //
showCloseButton: true, //
form: {
id: '',
type: '',
typename: '',
unit_price: '',
unit_num: '',
cost: '',
date: '',
sdate: '',
edate: '',
},
@ -172,10 +179,14 @@ export default {
},
computed: {
type2nameOptions() {
return Object.entries(this.type2name).map(([value, label]) => ({
if(this.type2name.length == 0) return true
let options = Object.entries(this.type2name).map(([value, label]) => ({
label,
value: Number(value) // value
}));
return [{ label: '检测类型', value: '' }, ...options];
}
},
watch: {
@ -248,10 +259,16 @@ export default {
this.init()
},
openDialog() {
this.form.type = ''
this.form.typename = ''
this.form.unit_price = ''
this.form.unit_num = ''
this.form = {
id: '',
type: '',
unit_price: '',
unit_num: '',
cost: '',
date: '',
sdate: '',
edate: '',
}
this.dialogVisible = true;
}, //
handleConfirm() {
@ -268,6 +285,7 @@ export default {
}
this.$http('POST', '/supernew/ajax_save_purchase', {
id: that.form.id,
type: that.form.type,
unit_price: that.form.unit_price,
unit_num: that.form.unit_num,
@ -275,6 +293,13 @@ export default {
this.$nextTick(() => {
if (!response.status) {
this.$message.warning(response.info);
} else {
if(that.form.id > 0){
this.$set(this.tableData, this.tableData.findIndex(item => item.id === this.form.id), {...this.form});
}else{
that.form.id = response.data
this.tableData.unshift(that.form);
}
}
this.dialogVisible = false;
})
@ -294,6 +319,7 @@ export default {
}
this.$http('POST', '/supernew/ajax_save_stage_purchase', {
id: that.form.id,
type: that.form.type,
unit_price: that.form.unit_price,
unit_num: that.form.unit_num,
@ -304,6 +330,13 @@ export default {
this.$nextTick(() => {
if (!response.status) {
this.$message.warning(response.info);
} else {
if(that.form.id > 0){
this.$set(this.tableData, this.tableData.findIndex(item => item.id === this.form.id), {...this.form});
}else{
that.form.id = response.data
this.tableData.unshift(that.form);
}
}
this.dialogVisible = false;
})
@ -334,21 +367,28 @@ export default {
return `${Y}-${M}-${D}`;
},
editPurchase(row) {
this.form.id = row.id
this.form.type = row.type
this.form.typename = this.type2name[row.type]
this.form.unit_price = row.unit_price
this.form.unit_num = row.unit_num
this.form = {...row};
this.dialogVisible = true;
},
editStagePurchase(row) {
this.form.id = row.id
this.form.type = row.type
this.form.typename = this.type2name[row.type]
this.form.unit_price = row.unit_price
this.form.unit_num = row.unit_num
this.form = {...row};
this.form.date = [row.start_date, row.end_date]
this.dialogVisible = true;
}
},
syncStagePurchase(row) {
this.$http('POST', '/supernew/ajax_sync_order_cost', {
id: row.id,
}).then(response => {
this.$nextTick(() => {
if (response.status) {
row.is_sync = 1;
}
this.$message.warning(response.info);
})
}).catch(error => {
this.$message.warning(error);
})
},
}
}
</script>

Loading…
Cancel
Save