|
@@ -1,60 +1,124 @@
|
|
|
<template>
|
|
|
<div style="width: 100%; padding: 0px 15px">
|
|
|
- <el-form :model="formData.data" :rules="rules" ref="formDom" label-position="top">
|
|
|
+ <el-form
|
|
|
+ :model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ ref="formDom"
|
|
|
+ label-position="top"
|
|
|
+ :disabled="judgeStatus()"
|
|
|
+ >
|
|
|
<div class="_t">申购信息</div>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="申购部门" prop="deptName">
|
|
|
- <el-input v-model="formData.data.deptName" placeholder="请输入"> </el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.deptName"
|
|
|
+ placeholder="请输入"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="申购人" prop="subcribeName">
|
|
|
- <el-input v-model="formData.data.subcribeName" placeholder="请输入"> </el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.subcribeName"
|
|
|
+ placeholder="请输入"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="申购时间" prop="subcribeTime">
|
|
|
- <el-date-picker v-model="formData.data.subcribeTime" type="datetime" placeholder="请选择" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.data.subcribeTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="请选择"
|
|
|
+ disabled
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-form-item label="申购说明" prop="subcribeContent">
|
|
|
- <el-input v-model="formData.data.subcribeContent" placeholder="请输入" type="textarea"> </el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.data.subcribeContent"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="textarea"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
<div class="_t">申购明细</div>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="openProduct = true" style="margin: 10px 0"> 添加货品 </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="openProduct = true"
|
|
|
+ style="margin: 10px 0"
|
|
|
+ >
|
|
|
+ 添加货品
|
|
|
+ </el-button>
|
|
|
<el-table :data="formData.data.subscribeDetailList">
|
|
|
- <el-table-column prop="goodType" label="货品类型" :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')" />
|
|
|
+ <el-table-column
|
|
|
+ prop="goodType"
|
|
|
+ label="货品类型"
|
|
|
+ :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
|
|
|
+ />
|
|
|
<el-table-column prop="code" label="货品编码" />
|
|
|
<el-table-column prop="name" label="货品名称" min-width="150" />
|
|
|
<el-table-column prop="spec" label="规格型号" />
|
|
|
- <el-table-column prop="unit" label="单位" />
|
|
|
+ <el-table-column
|
|
|
+ prop="unit"
|
|
|
+ label="单位"
|
|
|
+ :formatter="(row) => dictValueLabel(row.unit, productUnit)"
|
|
|
+ />
|
|
|
<el-table-column prop="count" label="申购数量" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="'subscribeDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
|
|
|
- <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="1" />
|
|
|
+ <el-form-item
|
|
|
+ :prop="'subscribeDetailList.' + $index + '.count'"
|
|
|
+ :rules="rules.count"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="row.count"
|
|
|
+ :precision="4"
|
|
|
+ :controls="false"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="remark" label="备注" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="'subscribeDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'subscribeDetailList.' + $index + '.remark'"
|
|
|
+ :rules="rules.remark"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
<el-input v-model="row.remark" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="zip" label="操作" width="100">
|
|
|
<template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <el-dialog v-model="openProduct" title="选择货品" width="70%" append-to-body>
|
|
|
- <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
|
|
|
+ <el-dialog
|
|
|
+ v-model="openProduct"
|
|
|
+ title="选择货品"
|
|
|
+ width="70%"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <SelectGoods
|
|
|
+ @cancel="openProduct = false"
|
|
|
+ @pushGoods="pushGoods"
|
|
|
+ ></SelectGoods>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -63,8 +127,12 @@
|
|
|
import SelectGoods from "@/components/product/SelectGoods";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
-
|
|
|
+const route = useRoute();
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
+// 接收父组件的传值
|
|
|
+const props = defineProps({
|
|
|
+ queryData: String,
|
|
|
+});
|
|
|
|
|
|
let formData = reactive({
|
|
|
data: {
|
|
@@ -74,8 +142,12 @@ let formData = reactive({
|
|
|
});
|
|
|
let rules = ref({
|
|
|
deptName: [{ required: true, message: "请输入申购部门", trigger: "blur" }],
|
|
|
- subcribeName: [{ required: true, message: "请输入申购人名称", trigger: "blur" }],
|
|
|
- subcribeTime: [{ required: true, message: "请选择申购时间", trigger: "change" }],
|
|
|
+ subcribeName: [
|
|
|
+ { required: true, message: "请输入申购人名称", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ subcribeTime: [
|
|
|
+ { required: true, message: "请选择申购时间", trigger: "change" },
|
|
|
+ ],
|
|
|
// subcribeContent: [
|
|
|
// { required: true, message: "请输入申购事由", trigger: "blur" },
|
|
|
// ],
|
|
@@ -95,12 +167,17 @@ const handleRemove = (index) => {
|
|
|
|
|
|
const pushGoods = (goods) => {
|
|
|
const arr = goods.map((x) => ({
|
|
|
- ...x,
|
|
|
+ goodType: x.goodType,
|
|
|
+ code: x.code,
|
|
|
+ name: x.name,
|
|
|
+ spec: x.spec,
|
|
|
+ unit: x.unit,
|
|
|
bussinessId: x.id,
|
|
|
count: "",
|
|
|
remark: "",
|
|
|
}));
|
|
|
- formData.data.subscribeDetailList = formData.data.subscribeDetailList.concat(arr);
|
|
|
+ formData.data.subscribeDetailList =
|
|
|
+ formData.data.subscribeDetailList.concat(arr);
|
|
|
openProduct.value = false;
|
|
|
return ElMessage({
|
|
|
message: "添加成功!",
|
|
@@ -127,11 +204,53 @@ const handleSubmit = async () => {
|
|
|
|
|
|
const userInfo = useUserStore().user;
|
|
|
onMounted(() => {
|
|
|
- formData.data.subcribeTime = proxy.parseTime(new Date());
|
|
|
- formData.data.deptName = userInfo.dept.deptName;
|
|
|
- formData.data.subcribeName = userInfo.nickName;
|
|
|
+ if (!route.query.processType) {
|
|
|
+ formData.data.subcribeTime = proxy.parseTime(new Date());
|
|
|
+ formData.data.deptName = userInfo.dept.deptName;
|
|
|
+ formData.data.subcribeName = userInfo.nickName;
|
|
|
+ } else {
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+const judgeStatus = () => {
|
|
|
+ if (props.queryData.recordList && props.queryData.recordList.length > 0) {
|
|
|
+ let data = props.queryData.recordList.filter(
|
|
|
+ (item) => item.status === 2 && item.nodeType !== 1
|
|
|
+ );
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+};
|
|
|
+
|
|
|
+watch(
|
|
|
+ props.queryData,
|
|
|
+ () => {
|
|
|
+ if (
|
|
|
+ props.queryData &&
|
|
|
+ (route.query.processType == 10 || route.query.processType == 20)
|
|
|
+ ) {
|
|
|
+ for (const key in props.queryData) {
|
|
|
+ formData.data[key] = props.queryData[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
+);
|
|
|
+const productUnit = ref([]);
|
|
|
+const getDict = () => {
|
|
|
+ proxy.getDictOne(["unit"]).then((res) => {
|
|
|
+ productUnit.value = res["unit"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+
|
|
|
defineExpose({
|
|
|
submitData: formData.data,
|
|
|
handleSubmit,
|