抄表周期及详情
This commit is contained in:
@@ -17,11 +17,11 @@
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<span>{{ form.unit }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本" prop="totalInNum">
|
||||
<el-input v-model.trim="form.totalInNum" placeholder="请输入成本" />
|
||||
<el-form-item label="成本" prop="costPrice">
|
||||
{{ form.costPrice }}
|
||||
</el-form-item>
|
||||
<el-form-item label="当前库存" prop="totalStockNum">
|
||||
<el-input-number v-model="form.totalStockNum" placeholder="请输入当前库存" />
|
||||
<el-form-item label="当前库存" prop="stockNum">
|
||||
<el-input-number v-model="form.stockNum" placeholder="请输入当前库存" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="margin-top: 30px">
|
||||
@@ -37,7 +37,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getMaterial, updateMaterial, addMaterial } from '@/api/system/Tmaterial';
|
||||
import { listStockMain, listStockUpdate } from '@/api/system/Tstock';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@@ -45,34 +45,26 @@ const route = useRoute();
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
materialId: '', // 物料名称
|
||||
materialId: '', // 物料id
|
||||
materialName: '', // 物料名称
|
||||
brand: '', // 联系电话
|
||||
model: '', // 邮箱
|
||||
unit: '', // 地址
|
||||
avgCostPrice: '', // 地址
|
||||
remark: '' // 备注
|
||||
brand: '', // 型号
|
||||
model: '', // 品牌
|
||||
unit: '', // 单位
|
||||
costPrice: '', // 成本价
|
||||
totalInNum: '', // 成本价
|
||||
stockNum: null // 库存数量
|
||||
});
|
||||
const rules = ref({
|
||||
materialName: [{ required: true, message: '请输入 物料名称', trigger: 'blur' }],
|
||||
brand: [{ required: true, message: '请输入 品牌', trigger: 'blur' }],
|
||||
model: [{ required: true, message: '请输入 规格型号', trigger: 'blur' }],
|
||||
unit: [{ required: true, message: '请输入 计量单位', trigger: 'blur' }]
|
||||
stockNum: [{ required: true, message: '请输入 物料名称', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getMaterial(userid.value).then((res) => {
|
||||
listStockMain(userid.value).then((res) => {
|
||||
form.value = {
|
||||
id: res.data.id,
|
||||
remark: res.data.remark,
|
||||
'materialId': res.data.materialId,
|
||||
'materialName': res.data.materialName,
|
||||
brand: res.data.brand,
|
||||
model: res.data.model,
|
||||
unit: res.data.unit,
|
||||
'avgCostPrice': res.data.avgCostPrice,
|
||||
'totalStockValue': res.data.totalStockValue
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -82,15 +74,10 @@ const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (userid.value) {
|
||||
updateMaterial(form.value).then((res) => {
|
||||
listStockUpdate(form.value).then((res) => {
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addMaterial(form.value).then((res) => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
<el-table-column label="品牌" align="center" prop="brand" />
|
||||
<el-table-column label="规格型号" align="center" prop="model" />
|
||||
<el-table-column label="单位" width="60" align="center" prop="unit" />
|
||||
<el-table-column label="成本" width="60" align="center" prop="avgCostPrice" />
|
||||
<el-table-column label="成本" width="100" align="center" prop="costPrice" />
|
||||
<el-table-column label="当前库存" width="80" align="center" prop="totalStockNum" />
|
||||
<el-table-column label="备注" show-overflow-tooltip align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:material:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['system:material:remove']">删除</el-button>
|
||||
<!-- <el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['system:material:remove']">删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -94,7 +94,7 @@ const { queryParams } = toRefs(data);
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listStock(queryParams.value);
|
||||
materialList.value = res.data;
|
||||
materialList.value = res.rows;
|
||||
total.value = res.total ?? 0;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user