物资管理新增修改

master
taozi 3 months ago
parent 0a87bed0ee
commit 4d7677ddf6
  1. 3
      src/views/materials/expend.vue
  2. 15
      src/views/materials/index.vue
  3. 230
      src/views/secondOrder/components/outDialog.vue
  4. 4
      src/views/secondOrder/components/recordDialog.vue

@ -113,7 +113,7 @@ export default {
columnBtn: false,
menuAlign: "left",
searchMenuPosition: "right",
menuWidth: 140,
menuWidth: 120,
column: [
{
label: "部门",
@ -126,6 +126,7 @@ export default {
prop: "materialCode",
headerAlign: "center",
align: "center",
// width: 160,
},
{
label: "名称",

@ -129,6 +129,8 @@ export default {
span: 12,
tip: "只能上传jpg/png文件",
hide: true,
limit: 1,
multiple: false,
httpRequest: this.handleUpload,
},
{
@ -164,6 +166,7 @@ export default {
formData.append("file", params.file);
upload(formData)
.then((res) => {
// picture
this.form.picture = res.data.message;
params.onSuccess(res);
})
@ -231,6 +234,11 @@ export default {
},
//
rowSave(row, done, loading) {
// picture
if (row.picture && Array.isArray(row.picture)) {
row.picture = row.picture[0] || '';
}
add(row).then(
() => {
this.onLoad(this.page);
@ -248,6 +256,11 @@ export default {
},
//
rowUpdate(row, index, done, loading) {
// picture
if (row.picture && Array.isArray(row.picture)) {
row.picture = row.picture[0] || '';
}
update(row).then(
() => {
this.onLoad(this.page);
@ -306,4 +319,4 @@ export default {
},
},
};
</script>
</script>

@ -1,56 +1,30 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
:title="outDialogTiltle"
:visible.sync="outDialogVisible"
:append-to-body="true"
@close="handleCloseDetail"
fullscreen
>
<el-dialog :close-on-click-modal="false" :title="outDialogTiltle" :visible.sync="outDialogVisible"
:append-to-body="true" @close="handleCloseDetail" fullscreen>
<div class="dialog-content">
<!-- 基本信息 -->
<el-form
:model="sizeForm"
ref="dynamicValidateForm"
label-width="100px"
class="demo-dynamic"
:rules="dynamicRules"
>
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic"
:rules="dynamicRules">
<div class="form-title">基本信息</div>
<el-row>
<el-col :span="12">
<el-form-item label="出库申请时间">
<el-date-picker
v-model="sizeForm.ldTwoOutStorage.outDate"
type="date"
placeholder="选择日期"
style="width: 100%"
disabled
>
<el-date-picker v-model="sizeForm.ldTwoOutStorage.outDate" type="date" placeholder="选择日期"
style="width: 100%" disabled>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="事由" prop="ldTwoOutStorage.reason">
<el-input
v-model="sizeForm.ldTwoOutStorage.reason"
:disabled="outDialogType != 'add'"
placeholder="请输入"
></el-input>
<el-input v-model="sizeForm.ldTwoOutStorage.reason" :disabled="outDialogType != 'add'"
placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="物资类型"
prop="ldTwoOutStorage.materialType"
>
<el-select
v-model="sizeForm.ldTwoOutStorage.materialType"
placeholder="请选择"
style="width: 100%"
:disabled="outDialogType != 'add'"
>
<el-form-item label="物资类型" prop="ldTwoOutStorage.materialType">
<el-select v-model="sizeForm.ldTwoOutStorage.materialType" placeholder="请选择" style="width: 100%"
:disabled="outDialogType != 'add'">
<el-option label="办公室物资" value="1"></el-option>
<el-option label="其他物资" value="2"></el-option>
</el-select>
@ -58,80 +32,38 @@
</el-col>
<el-col :span="12">
<el-form-item label="部门" prop="ldTwoOutStorage.departmentInfo">
<el-select
v-model="sizeForm.ldTwoOutStorage.departmentInfo"
placeholder="请选择"
style="width: 100%"
:disabled="outDialogType != 'add'"
@change="deptChange"
clearable
filterable
value-key="departmentId"
>
<el-option
v-for="item in departmentOptions"
:key="item.departmentId"
:label="item.department"
:value="item"
></el-option>
<el-select v-model="sizeForm.ldTwoOutStorage.departmentInfo" placeholder="请选择" style="width: 100%"
:disabled="outDialogType != 'add'" @change="deptChange" clearable filterable value-key="departmentId">
<el-option v-for="item in departmentOptions" :key="item.departmentId" :label="item.department"
:value="item"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="领用人" prop="ldTwoOutStorage.proposerInfo">
<el-select
v-model="sizeForm.ldTwoOutStorage.proposerInfo"
placeholder="请选择"
style="width: 100%"
:disabled="
sizeForm.departmentId == '' || outDialogType == 'details'
"
clearable
filterable
value-key="userId"
@change="proposerChange"
>
<el-option
v-for="item in userOptions"
:key="item.userId"
:label="item.name"
:value="item"
>
<el-select v-model="sizeForm.ldTwoOutStorage.proposerInfo" placeholder="请选择" style="width: 100%"
:disabled="sizeForm.departmentId == '' || outDialogType == 'details'
" clearable filterable value-key="userId" @change="proposerChange">
<el-option v-for="item in userOptions" :key="item.userId" :label="item.name" :value="item">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if="outDialogType == 'details'">
<el-form-item label="填报人">
<el-input
v-model="sizeForm.ldTwoOutStorage.shipperName"
:disabled="outDialogType != 'add'"
></el-input>
<el-input v-model="sizeForm.ldTwoOutStorage.shipperName" :disabled="outDialogType != 'add'"></el-input>
</el-form-item>
</el-col>
</el-row>
<div class="form-title">{{ outDateInfo }} 出库信息</div>
<el-button
type="primary"
size="mini"
style="margin-bottom: 18px"
@click="categoryHandle"
v-if="outDialogType != 'details'"
>新增</el-button
>
<el-table
:data="sizeForm.ldTwoOutStorageDetailList"
border
style="width: 100%"
>
<el-button type="primary" size="mini" style="margin-bottom: 18px" @click="categoryHandle"
v-if="outDialogType != 'details'">新增</el-button>
<el-table :data="sizeForm.ldTwoOutStorageDetailList" border style="width: 100%">
<el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column
prop="materialName"
label="物资名称"
></el-table-column>
<el-table-column prop="materialName" label="物资名称"></el-table-column>
<el-table-column prop="model" label="规格/型号"> </el-table-column>
<el-table-column prop="type" label="类别">
<template slot-scope="scope">
@ -139,38 +71,24 @@
scope.row.type === "NY"
? "耐用品"
: scope.row.type === "YH"
? "易耗品"
: ""
? "易耗品"
: ""
}}
</template>
</el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column prop="num" label="数量">
<template slot-scope="scope">
<el-input-number
size="mini"
v-model="scope.row.num"
:min="0"
style="width: 100%"
:disabled="outDialogType != 'add' || scope.row.type === 'NY'"
@change="
<el-input-number size="mini" v-model="scope.row.num" :min="0" style="width: 100%"
:disabled="outDialogType != 'add' || scope.row.type === 'NY'" @change="
(newValue) => handleQuantityChange(newValue, scope.$index)
"
></el-input-number>
"></el-input-number>
</template>
</el-table-column>
<el-table-column
label="操作"
width="100"
v-if="outDialogType != 'details'"
>
<el-table-column label="操作" width="100" v-if="outDialogType != 'details'">
<template slot-scope="scope">
<div :disabled="outDialogType == 'details'">
<el-button
type="text"
size="mini"
@click="handleDelete(scope.$index, scope.row)"
>
<el-button type="text" size="mini" @click="handleDelete(scope.$index, scope.row)">
删除
</el-button>
</div>
@ -180,12 +98,7 @@
<div class="form-title" v-if="outDialogType != 'details'">
出库账目表格
</div>
<el-table
:data="statisticsList"
border
style="width: 100%"
v-if="outDialogType != 'details'"
>
<el-table :data="statisticsList" border style="width: 100%" v-if="outDialogType != 'details'">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialCode" label="编码">
</el-table-column>
@ -202,7 +115,7 @@
<el-table-column prop="date" label="出库后库存">
<el-table-column prop="totalQuantity" label="数量"> </el-table-column>
</el-table-column>
<el-table-column prop="date" label="出库信息">
<el-table-column prop="date" label="出库信息">
<el-table-column label="出库人">
<template slot-scope="scope">
{{
@ -224,24 +137,13 @@
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseDetail()"> </el-button>
<el-button
v-if="outDialogType != 'details'"
type="primary"
@click="sumbit()"
> </el-button
>
<el-button v-if="outDialogType != 'details'" type="primary" @click="sumbit()"> </el-button>
</span>
</el-dialog>
<!-- 新增数据 -->
<categoryDialog
v-if="categoryVisible"
:categoryVisible="categoryVisible"
:selectionData="selectionData"
:departmentId="sizeForm.ldTwoOutStorage.departmentId"
:categoryDialogTitle="categoryDialogTitle"
@confirm="confirm"
@categoryClose="categoryClose"
></categoryDialog>
<categoryDialog v-if="categoryVisible" :categoryVisible="categoryVisible" :selectionData="selectionData"
:departmentId="sizeForm.ldTwoOutStorage.departmentId" :categoryDialogTitle="categoryDialogTitle"
@confirm="confirm" @categoryClose="categoryClose"></categoryDialog>
</div>
</template>
<script>
@ -394,7 +296,7 @@ export default {
);
return {
...stat,
theOutboundQuantity: detail.num||0, //
theOutboundQuantity: detail.num || 0, //
unitPrice: detail.unitPrice,
totalQuantity: stat.num - detail.num,
};
@ -404,7 +306,7 @@ export default {
categoryHandle() {
if((!this.sizeForm.ldTwoOutStorage.proposerInfo)||(!this.sizeForm.ldTwoOutStorage.departmentInfo)){
if ((!this.sizeForm.ldTwoOutStorage.proposerInfo) || (!this.sizeForm.ldTwoOutStorage.departmentInfo)) {
this.$message.error('请先选择部门和领用人');
return false
}
@ -427,23 +329,43 @@ export default {
JSON.stringify(this.sizeForm.ldTwoOutStorageDetailList)
);
},
handleQuantityChange(newValue, index) {
const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index];
if (!currentRow) return;
if (currentRow.type === "NY") {
currentRow.num = 1;
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
return;
}
const stockNum = currentRow.num; //
currentRow.oldNum = stockNum; //
currentRow.num = newValue; //
currentRow.newNum = stockNum - newValue; //
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
this.getStatistics()
},
handleQuantityChange(newValue, index) {
console.log(newValue,'点击数量变化数量的值')
const currentRow = this.sizeForm.ldTwoOutStorageDetailList[index];
// selectionDataselectionData
const selectionItem = this.selectionData[index]; // selectionItem
if (!currentRow) return;
//
if (currentRow.type === "NY") {
currentRow.num = 1;
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
return;
}
//
if (selectionItem && newValue > selectionItem.num) {
this.$message.warning(`出库数量不能超过库存数量【${selectionItem.num}】!`);
//
currentRow.num = selectionItem.num;
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
this.getStatistics();
return;
}
// selectionData
const stockNum = selectionItem ? selectionItem.num : currentRow.oldNum || currentRow.num;
currentRow.oldNum = stockNum; //
currentRow.num = newValue; //
currentRow.newNum = stockNum - newValue; //
this.$set(this.sizeForm.ldTwoOutStorageDetailList, index, currentRow);
this.$set(this.sizeForm.inAccountsTableData, index, { ...currentRow });
this.getStatistics();
},
//
updateGlobalTotal() {

@ -6,11 +6,12 @@
width="50%"
@close="closeDialog"
>
<el-tabs v-model="transactionType" @tab-click="handleTabClick">
<el-tab-pane label="出库" name="1"></el-tab-pane>
<el-tab-pane label="入库" name="2"></el-tab-pane>
</el-tabs>
<div style="height: 400px;">
<avue-crud
:data="data"
:option="option"
@ -23,6 +24,7 @@
:page.sync="page"
></avue-crud>
</div>
</el-dialog>
</template>
<script>

Loading…
Cancel
Save