单价管理
This commit is contained in:
parent
f4abb862c7
commit
4ab4596fbc
80
src/api/yh/price.js
Normal file
80
src/api/yh/price.js
Normal file
|
@ -0,0 +1,80 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询单价列表
|
||||
export function listPrice(query) {
|
||||
return request({
|
||||
url: '/yh/price/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询单价详细
|
||||
export function getPrice(priceId) {
|
||||
return request({
|
||||
url: '/yh/price/' + priceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增单价
|
||||
export function addPrice(data) {
|
||||
return request({
|
||||
url: '/yh/price',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改单价
|
||||
export function updatePrice(data) {
|
||||
return request({
|
||||
url: '/yh/price',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除单价
|
||||
export function delPrice(priceId) {
|
||||
return request({
|
||||
url: '/yh/price/' + priceId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 提交单价
|
||||
export function submitPrice(priceId) {
|
||||
return request({
|
||||
url: `/yh/price/${priceId}/submit`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 取消提交单价
|
||||
export function cancelPrice(priceId) {
|
||||
return request({
|
||||
url: `/yh/price/${priceId}/cancel`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 审核单价
|
||||
export function verifyPrice(priceId, pass) {
|
||||
return request({
|
||||
url: `/yh/price/verify`,
|
||||
method: 'put',
|
||||
data: {
|
||||
priceId,
|
||||
pass
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 单价禁用
|
||||
export function disablePrice(priceId) {
|
||||
return request({
|
||||
url: `/yh/price/${priceId}/disable`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
36
src/components/BooleanTag/index.vue
Normal file
36
src/components/BooleanTag/index.vue
Normal file
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
<el-tag :type="value ? trueType : falseType" :size="size">{{value ? trueText : falseText}}</el-tag>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "BooleanTag",
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
required: true
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
trueText: {
|
||||
type: String,
|
||||
default: '是'
|
||||
},
|
||||
falseText: {
|
||||
type: String,
|
||||
default: '否'
|
||||
},
|
||||
trueType: {
|
||||
type: String,
|
||||
default: 'success'
|
||||
},
|
||||
falseType: {
|
||||
type: String,
|
||||
default: 'danger'
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
79
src/components/Business/Dept/DeptTreeSelect.vue
Normal file
79
src/components/Business/Dept/DeptTreeSelect.vue
Normal file
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<treeselect
|
||||
v-model="computedValue"
|
||||
:options="deptOptions"
|
||||
:normalizer="normalizer"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
@select="onSelect"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listDept} from "@/api/system/dept";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import { isDeepEqual } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: "DeptTreeSelect",
|
||||
components: { Treeselect },
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '选择部门'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
deptOptions: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
computedValue: {
|
||||
get() {
|
||||
return this.value;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val);
|
||||
if (!isDeepEqual(val, this.value)) {
|
||||
this.$emit('change', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeptTree();
|
||||
},
|
||||
methods: {
|
||||
getDeptTree() {
|
||||
listDept().then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||
});
|
||||
},
|
||||
/** 转换运营商数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.deptId,
|
||||
label: node.deptName,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
onSelect(data) {
|
||||
this.$emit('select', data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
|
@ -1,3 +1,31 @@
|
|||
// 视图
|
||||
export const views = {
|
||||
}
|
||||
|
||||
// 单价状态
|
||||
export const PriceStatus = {
|
||||
WAIT_SUBMIT: "1", // 未提交
|
||||
WAIT_VERIFY: "2", // 待审核
|
||||
PASS: "3", // 已通过
|
||||
REJECT: "4", // 未通过
|
||||
// 允许编辑
|
||||
canEdit(status) {
|
||||
return [this.WAIT_SUBMIT].includes(status);
|
||||
},
|
||||
// 允许提交
|
||||
canSubmit(status) {
|
||||
return [this.WAIT_SUBMIT].includes(status);
|
||||
},
|
||||
// 允许取消提交
|
||||
canCancel(status) {
|
||||
return [this.WAIT_VERIFY].includes(status);
|
||||
},
|
||||
// 允许审核
|
||||
canVerify(status) {
|
||||
return [this.WAIT_VERIFY].includes(status);
|
||||
},
|
||||
// 允许禁用
|
||||
canDisable(status) {
|
||||
return [this.PASS].includes(status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
const filters = {
|
||||
// 金钱显示,保留两位小数
|
||||
money(num) {
|
||||
if (num == null) {
|
||||
return num;
|
||||
}
|
||||
return num.toFixed(2);
|
||||
return filters.fix2(num);
|
||||
},
|
||||
// 缺省值
|
||||
defaultValue(data) {
|
||||
return data == null ? '--' : data;
|
||||
},
|
||||
fix2(num) {
|
||||
return filters.money(num);
|
||||
if (num == null) {
|
||||
return num;
|
||||
}
|
||||
return num.toFixed(2);
|
||||
},
|
||||
fix10(num) {
|
||||
if (num == null) {
|
||||
return num;
|
||||
}
|
||||
return num.toFixed(10);
|
||||
},
|
||||
dv(data) {
|
||||
return filters.defaultValue(data);
|
||||
|
|
|
@ -388,3 +388,28 @@ export function isNumberStr(str) {
|
|||
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
||||
}
|
||||
|
||||
// 深度比较两个对象是否相等
|
||||
export function isDeepEqual(obj1, obj2) {
|
||||
if (obj1 === obj2) return true;
|
||||
|
||||
if (typeof obj1 !== typeof obj2) return false;
|
||||
|
||||
if (Array.isArray(obj1)) {
|
||||
if (!Array.isArray(obj2) || obj1.length !== obj2.length) return false;
|
||||
for (let i = 0; i < obj1.length; i++) {
|
||||
if (!isDeepEqual(obj1[i], obj2[i])) return false;
|
||||
}
|
||||
} else if (typeof obj1 === 'object' && obj1 !== null) {
|
||||
const keys1 = Object.keys(obj1);
|
||||
const keys2 = Object.keys(obj2);
|
||||
if (keys1.length !== keys2.length) return false;
|
||||
for (let key of keys1) {
|
||||
if (!isDeepEqual(obj1[key], obj2[key])) return false;
|
||||
}
|
||||
} else {
|
||||
// 如果两者都不是数组也不是对象,直接比较值
|
||||
return obj1 === obj2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
106
src/views/yh/price/components/VerifyPriceDialog.vue
Normal file
106
src/views/yh/price/components/VerifyPriceDialog.vue
Normal file
|
@ -0,0 +1,106 @@
|
|||
<template>
|
||||
<el-dialog :visible.sync="show" width="1000px" title="审核单价" center>
|
||||
<el-descriptions v-loading="loading">
|
||||
<el-descriptions-item label="部门">{{detail.deptName | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="类别">{{detail.category | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="大小">{{detail.size | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="工序">{{detail.name | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="子工序">{{detail.subName | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="图案">{{detail.pattern | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">{{detail.pattern | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="单价">{{detail.price | dv}} 元</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">{{detail.unit | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="分类">{{detail.classify | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产数量">{{detail.quantity | fix2 | dv}} 个</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{detail.remark | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人">{{detail.createBy | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{detail.createTime | dv}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<template #footer>
|
||||
<el-button type="success" plain icon="el-icon-check" @click="submitVerify(true)" :loading="submitLoading">通过</el-button>
|
||||
<el-button type="danger" plain icon="el-icon-close" @click="submitVerify(false)" :loading="submitLoading">驳回</el-button>
|
||||
</template>
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {getPrice, verifyPrice} from "@/api/yh/price";
|
||||
|
||||
export default {
|
||||
name: "VerifyPriceDialog",
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
priceId: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
show: {
|
||||
get() {
|
||||
return this.visible;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:visible', val);
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
detail: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
priceId(nv, ov) {
|
||||
this.getDetail(nv);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDetail(this.priceId);
|
||||
},
|
||||
methods: {
|
||||
submitVerify(pass) {
|
||||
this.$confirm(`确定要${pass ? '通过' : '驳回'}吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.submitLoading = true;
|
||||
verifyPrice(this.priceId, pass).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(pass ? '通过成功' : '驳回成功');
|
||||
this.show = false;
|
||||
this.$emit('success');
|
||||
}
|
||||
}).finally(() => {
|
||||
this.submitLoading = false;
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取详情
|
||||
getDetail(priceId) {
|
||||
if (priceId == null) {
|
||||
this.detail = {};
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
getPrice(priceId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.detail = res.data;
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
617
src/views/yh/price/index.vue
Normal file
617
src/views/yh/price/index.vue
Normal file
|
@ -0,0 +1,617 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="部门" prop="deptId">
|
||||
<dept-tree-select v-model="queryParams.deptId" style="width: 15em" @change="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="dict in dict.type.price_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类别" prop="category">
|
||||
<el-input
|
||||
v-model="queryParams.category"
|
||||
placeholder="请输入类别"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="大小" prop="size">
|
||||
<el-input
|
||||
v-model="queryParams.size"
|
||||
placeholder="请输入大小"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工序" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入工序名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="子工序" prop="subName">
|
||||
<el-input
|
||||
v-model="queryParams.subName"
|
||||
placeholder="请输入子工序名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图案" prop="pattern">
|
||||
<el-input
|
||||
v-model="queryParams.pattern"
|
||||
placeholder="请输入图案"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input
|
||||
v-model="queryParams.spec"
|
||||
placeholder="请输入规格"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input
|
||||
v-model="queryParams.unit"
|
||||
placeholder="请输入单位"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
placeholder="请输入备注"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="classify">
|
||||
<el-input
|
||||
v-model="queryParams.classify"
|
||||
placeholder="请输入分类"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="createBy">
|
||||
<el-input
|
||||
v-model="queryParams.createBy"
|
||||
placeholder="请输入创建人名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核人" prop="verifyBy">
|
||||
<el-input
|
||||
v-model="queryParams.verifyBy"
|
||||
placeholder="请输入审核人名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updateBy">
|
||||
<el-input
|
||||
v-model="queryParams.updateBy"
|
||||
placeholder="请输入更新人名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="禁用状态" prop="disabled">
|
||||
<el-radio-group v-model="queryParams.disabled" @change="handleQuery">
|
||||
<el-radio :label="null">全部</el-radio>
|
||||
<el-radio :label="false">启用</el-radio>
|
||||
<el-radio :label="true">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-has-permi="['yh:price:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-has-permi="['yh:price:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="priceList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<template v-for="column of showColumns">
|
||||
<el-table-column
|
||||
:key="column.key"
|
||||
:label="column.label"
|
||||
:prop="column.key"
|
||||
:align="column.align"
|
||||
:min-width="column.minWidth"
|
||||
:sort-orders="orderSorts"
|
||||
:sortable="column.sortable"
|
||||
:show-overflow-tooltip="column.overflow"
|
||||
:width="column.width"
|
||||
>
|
||||
<template slot-scope="d">
|
||||
<template v-if="column.key === 'priceId'">
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<dict-tag :options="dict.type.price_status" :value="d.row[column.key]"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'disabled'">
|
||||
<boolean-tag :value="d.row.disabled" true-text="禁用" true-type="danger" false-text="禁用" false-type="success" />
|
||||
</template>
|
||||
<template v-else-if="column.key === 'quantity'">
|
||||
{{d.row.quantity | fix2 | dv}} 个
|
||||
</template>
|
||||
<template v-else-if="column.key === 'price'">
|
||||
{{d.row.price | dv}} 元
|
||||
</template>
|
||||
<template v-else>
|
||||
{{d.row[column.key] | dv}}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-has-permi="['yh:price:edit']"
|
||||
v-show="PriceStatus.canEdit(scope.row.status)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-upload2"
|
||||
@click="handleSubmit(scope.row)"
|
||||
v-has-permi="['yh:price:submit']"
|
||||
v-show="PriceStatus.canSubmit(scope.row.status)"
|
||||
>提交</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="handleCancel(scope.row)"
|
||||
v-has-permi="['yh:price:cancel']"
|
||||
v-show="PriceStatus.canCancel(scope.row.status)"
|
||||
>取消提交</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-s-check"
|
||||
@click="handleVerify(scope.row)"
|
||||
v-has-permi="['yh:price:verify']"
|
||||
v-show="PriceStatus.canVerify(scope.row.status)"
|
||||
>审核</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-remove-outline"
|
||||
@click="handleDisable(scope.row)"
|
||||
v-has-permi="['yh:price:disable']"
|
||||
v-show="PriceStatus.canDisable(scope.row.status) && !scope.row.disabled"
|
||||
>禁用</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改单价对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row :gutter="gutter">
|
||||
<form-col :span="span" label="部门" prop="deptId">
|
||||
<dept-tree-select v-model="form.deptId" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="类别" prop="category">
|
||||
<el-input v-model="form.category" placeholder="请输入类别" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="大小" prop="size">
|
||||
<el-input v-model="form.size" placeholder="请输入大小" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="工序" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入工序名称" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="子工序" prop="subName">
|
||||
<el-input v-model="form.subName" placeholder="请输入子工序名称" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="图案" prop="pattern">
|
||||
<el-input v-model="form.pattern" placeholder="请输入图案" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入规格" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="单价" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入单价" type="number" :min="0"/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="分类" prop="classify">
|
||||
<el-input v-model="form.classify" placeholder="请输入分类" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="生产数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入生产数量(个)" >
|
||||
<template #suffix>个</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" maxlength="200" show-word-limit/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<verify-price-dialog :visible.sync="showVerifyDialog" :price-id="row.priceId" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPrice,
|
||||
getPrice,
|
||||
delPrice,
|
||||
addPrice,
|
||||
updatePrice,
|
||||
submitPrice,
|
||||
disablePrice,
|
||||
cancelPrice
|
||||
} from "@/api/yh/price";
|
||||
import { $showColumns } from '@/utils/mixins';
|
||||
import DeptTreeSelect from "@/components/Business/Dept/DeptTreeSelect.vue";
|
||||
import BooleanTag from "@/components/BooleanTag/index.vue";
|
||||
import {PriceStatus} from "@/utils/constants";
|
||||
import VerifyPriceDialog from "@/views/yh/price/components/VerifyPriceDialog.vue";
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
prop: "createTime",
|
||||
order: "descending"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "Price",
|
||||
computed: {
|
||||
PriceStatus() {
|
||||
return PriceStatus
|
||||
}
|
||||
},
|
||||
components: {FormCol, VerifyPriceDialog, BooleanTag, DeptTreeSelect},
|
||||
mixins: [$showColumns],
|
||||
dicts: ['price_status'],
|
||||
data() {
|
||||
return {
|
||||
// 审核弹窗
|
||||
showVerifyDialog: false,
|
||||
// 当前行
|
||||
row: {},
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: 'priceId', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'deptName', visible: true, label: '部门', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'status', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'category', visible: true, label: '类别', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'size', visible: true, label: '大小', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'name', visible: true, label: '工序', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'subName', visible: true, label: '子工序', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'pattern', visible: true, label: '图案', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'spec', visible: true, label: '规格', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'price', visible: true, label: '单价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'unit', visible: true, label: '单位', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'classify', visible: true, label: '分类', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'quantity', visible: true, label: '生产数量', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'createBy', visible: true, label: '创建人', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'verifyBy', visible: true, label: '审核人', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'verifyTime', visible: true, label: '审核时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'updateId', visible: true, label: '更新人', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'updateTime', visible: true, label: '更新时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'disabled', visible: true, label: '禁用状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'disabledTime', visible: true, label: '禁用时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
|
||||
],
|
||||
// 排序方式
|
||||
orderSorts: ['ascending', 'descending', null],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 单价表格数据
|
||||
priceList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
defaultSort,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
orderByColumn: defaultSort.prop,
|
||||
isAsc: defaultSort.order,
|
||||
priceId: null,
|
||||
deptId: null,
|
||||
status: null,
|
||||
category: null,
|
||||
size: null,
|
||||
name: null,
|
||||
subName: null,
|
||||
pattern: null,
|
||||
spec: null,
|
||||
unit: null,
|
||||
remark: null,
|
||||
classify: null,
|
||||
createId: null,
|
||||
createBy: null,
|
||||
verifyId: null,
|
||||
verifyBy: null,
|
||||
updateId: null,
|
||||
updateBy: null,
|
||||
disabled: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
deptId: [
|
||||
{ required: true, message: "部门ID不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: "单价不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "单位不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
createId: [
|
||||
{ required: true, message: "创建人ID不能为空", trigger: "blur" }
|
||||
],
|
||||
createBy: [
|
||||
{ required: true, message: "创建人名称不能为空", trigger: "blur" }
|
||||
],
|
||||
disabled: [
|
||||
{ required: true, message: "是否禁用不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 当排序按钮被点击时触发 **/
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
this.queryParams.isAsc = defaultSort.order;
|
||||
} else {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询单价列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPrice(this.queryParams).then(response => {
|
||||
this.priceList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
priceId: null,
|
||||
deptId: null,
|
||||
status: null,
|
||||
category: null,
|
||||
size: null,
|
||||
name: null,
|
||||
subName: null,
|
||||
pattern: null,
|
||||
spec: null,
|
||||
price: null,
|
||||
unit: null,
|
||||
remark: null,
|
||||
classify: null,
|
||||
createTime: null,
|
||||
createId: null,
|
||||
createBy: null,
|
||||
verifyTime: null,
|
||||
verifyId: null,
|
||||
verifyBy: null,
|
||||
updateTime: null,
|
||||
updateId: null,
|
||||
updateBy: null,
|
||||
disabled: null,
|
||||
disabledTime: null,
|
||||
quantity: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.priceId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加单价";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const priceId = row.priceId || this.ids
|
||||
getPrice(priceId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改单价";
|
||||
});
|
||||
},
|
||||
// 提交
|
||||
handleSubmit(row) {
|
||||
this.$confirm('确定提交吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
submitPrice(row.priceId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("提交成功");
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 取消提交
|
||||
handleCancel(row) {
|
||||
this.$confirm('确定取消吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
cancelPrice(row.priceId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("取消成功");
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 审核
|
||||
handleVerify(row) {
|
||||
this.row = row;
|
||||
this.showVerifyDialog = true;
|
||||
},
|
||||
// 禁用
|
||||
handleDisable(row) {
|
||||
this.$confirm('确定禁用吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
disablePrice(row.priceId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("禁用成功");
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.priceId != null) {
|
||||
updatePrice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPrice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const priceIds = row.priceId || this.ids;
|
||||
this.$modal.confirm('是否确认删除单价编号为"' + priceIds + '"的数据项?').then(function() {
|
||||
return delPrice(priceIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('yh/price/export', {
|
||||
...this.queryParams
|
||||
}, `price_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user