Compare commits

...

3 Commits

  1. 1
      src/api/firstOrder/inbound.js
  2. 11
      src/api/materials/expend.js
  3. 11
      src/api/materials/index.js
  4. 2
      src/views/firstOrder/inbound.vue
  5. 69
      src/views/materials/components/returnDialog.vue
  6. 54
      src/views/materials/components/scrapDialog.vue
  7. 14
      src/views/materials/expend.vue
  8. 10
      src/views/materials/index.vue
  9. 12
      src/views/secondOrder/outbound.vue

@ -72,7 +72,6 @@ export const submitData = (sizeForm) => {
}) })
} }
export const editList = (onePutStorageId) => { export const editList = (onePutStorageId) => {
console.log('api中的数据',onePutStorageId)
return request({ return request({
url: '/smartpark/onePutStorage/detail', url: '/smartpark/onePutStorage/detail',
method: 'get', method: 'get',

@ -13,3 +13,14 @@ export const getList = (current, size, params) => {
cryptoData: false cryptoData: false
}) })
} }
//归还和报废
export const returnMaterial = (LdDurableFormDto) => {
console.log(LdDurableFormDto,'api传的參')
return request({
url: '/smartpark/durableForm/restoreAndScrap ',
method: 'post',
data: LdDurableFormDto,
cryptoToken: false,
cryptoData: false
})
}

@ -0,0 +1,11 @@
import request from '@/router/axios';
export const upload = (file) => {
return request({
url: '/smartpark/material/upload ',
method: 'post',
data: file,
cryptoToken: false,
cryptoData: false
})
}

@ -135,7 +135,7 @@ export default {
width: 180, width: 180,
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
slot: "purchaseEndInfo" slot: "purchaseEndInfo",
width: 150, width: 150,
align: "center", align: "center",
formatter: (row, column) => { formatter: (row, column) => {

@ -6,7 +6,7 @@
width="30%" width="30%"
@close="closeDialog" @close="closeDialog"
> >
<avue-form ref="form" :option="option"></avue-form> <avue-form ref="form" :option="option" v-model="formData"></avue-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -17,38 +17,50 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {returnMaterial} from '@/api/materials/expend'
export default { export default {
props: { props: {
showDialog: { showDialog: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
// durableFormId
durableFormId: {
type: Number,
default: 0,
}
}, },
data() { data() {
const today = new Date();
const defaultDate = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`;
return { return {
purchaseTitle:'归还', purchaseTitle:'归还',
openShow: false, openShow: false,
formData: {
returnReason: '',
returnTime: defaultDate,
},
option: { option: {
submitBtn: false, submitBtn: false,
emptyBtn: false, emptyBtn: false,
column: [ column: [
{ // {
label: "归还数量", // label: "",
prop: "name", // prop: "name",
span: 24, // span: 24,
type: "number", // type: "number",
rules: [ // hide: true,
{ // rules: [
required: true, // {
message: "请输入", // required: true,
trigger: "blur", // message: "",
}, // trigger: "blur",
], // },
}, // ],
// },
{ {
label: "归还理由", label: "归还理由",
prop: "sex", prop: "returnReason",
span: 24, span: 24,
type:'textarea', type:'textarea',
rows:5, rows:5,
@ -62,9 +74,9 @@ export default {
}, },
{ {
label: "归还时间", label: "归还时间",
prop: "sex", prop: "returnTime",
span: 24, span: 24,
type:'textarea', type:'date',
rows:5, rows:5,
rules: [ rules: [
{ {
@ -86,10 +98,25 @@ export default {
this.openShow = false; this.openShow = false;
this.$emit("closeDialog"); this.$emit("closeDialog");
}, },
submit() { async submit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
this.$emit("submit", this.formData); try {
const params = {
durableFormId: this.durableFormId,
num: 1,
returnTime: this.formData.returnTime,
returnReason: this.formData.returnReason,
type: 1
}
await returnMaterial(params)
this.$message.success('归还成功')
this.closeDialog()
this.$emit('submitSuccess')
this.$refs.form.resetFields()
} catch (error) {
this.$message.error(error.message || '归还失败,请重试')
}
} }
}); });
}, },

@ -6,7 +6,7 @@
width="30%" width="30%"
@close="closeDialog" @close="closeDialog"
> >
<avue-form ref="form" :option="option"></avue-form> <avue-form ref="form" :option="option" v-model="formData"></avue-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -17,17 +17,26 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {returnMaterial} from '@/api/materials/expend'
export default { export default {
props: { props: {
showDialog: { showDialog: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
durableFormId: {
type: Number,
default: 0,
}
}, },
data() { data() {
const today = new Date();
const defaultDate = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`;
return { return {
formData: {
returnReason: '',
returnTime: defaultDate,
},
purchaseTitle:'报废', purchaseTitle:'报废',
openShow: false, openShow: false,
option: { option: {
@ -36,20 +45,14 @@ export default {
column: [ column: [
{ {
label: "报废数量", label: "报废数量",
prop: "name", prop: "num",
span: 24, span: 24,
type: "number", value: 1,
rules: [ disabled: true,
{
required: true,
message: "请输入",
trigger: "blur",
},
],
}, },
{ {
label: "报废理由", label: "报废理由",
prop: "sex", prop: "returnReason",
span: 24, span: 24,
type:'textarea', type:'textarea',
rows:5, rows:5,
@ -63,9 +66,9 @@ export default {
}, },
{ {
label: "报废时间", label: "报废时间",
prop: "sex", prop: "returnTime",
span: 24, span: 24,
type:'textarea', type:'date',
rows:5, rows:5,
rules: [ rules: [
{ {
@ -87,10 +90,25 @@ export default {
this.openShow = false; this.openShow = false;
this.$emit("closeDialog"); this.$emit("closeDialog");
}, },
submit() { async submit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
this.$emit("submit", this.formData); try {
const params = {
durableFormId: this.durableFormId,
num: 1,
returnTime: this.formData.returnTime,
returnReason: this.formData.returnReason,
type: 2
}
await returnMaterial(params)
this.$message.success('报废成功')
this.closeDialog()
this.$emit('submitSuccess')
this.$refs.form.resetFields()
} catch (error) {
this.$message.error(error.message || '报废失败,请重试')
}
} }
}); });
}, },

@ -43,6 +43,8 @@
:showDialog="returnShow" :showDialog="returnShow"
:rowDta="returnInfo" :rowDta="returnInfo"
@closeDialog="closeDialog" @closeDialog="closeDialog"
:durableFormId="returnInfo.id"
@submitSuccess="handleRefresh"
></returnDialog> ></returnDialog>
<!-- 报废 --> <!-- 报废 -->
<scrapDialog <scrapDialog
@ -50,6 +52,8 @@
:showDialog="scrapShow" :showDialog="scrapShow"
:rowDta="scrapInfo" :rowDta="scrapInfo"
@closeDialog="closeDialog" @closeDialog="closeDialog"
:durableFormId="scrapInfo.id"
@submitSuccess="handleRefresh"
></scrapDialog> ></scrapDialog>
</div> </div>
</template> </template>
@ -280,10 +284,9 @@ export default {
page.pageSize, page.pageSize,
Object.assign(params, this.query) Object.assign(params, this.query)
).then((res) => { ).then((res) => {
this.data = res.data.result.list; this.data = res.data.result.list
this.loading = false; this.page.total = res.data.result.total
this.page.total = res.data.result.total; })
});
this.loading = false; this.loading = false;
}, },
// //
@ -297,6 +300,9 @@ export default {
this.scrapShow = true; this.scrapShow = true;
this.scrapInfo = JSON.parse(JSON.stringify(row)); this.scrapInfo = JSON.parse(JSON.stringify(row));
}, },
handleRefresh() {
this.onLoad(this.page, this.query);
},
}, },
}; };
</script> </script>

@ -10,10 +10,10 @@
</template> </template>
<script> <script>
import { getList, add, remove, update, getCode } from "@/api/materials/list"; import { getList, add, remove, update, getCode } from "@/api/materials/list";
import { upload } from "@/api/materials/index";
export default { export default {
data() { data() {
return { return {
form: { imageUrl: "" },
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
@ -95,6 +95,7 @@ export default {
return value; return value;
} }
}, },
{ {
label: '图片', label: '图片',
prop: 'picture', prop: 'picture',
@ -103,6 +104,7 @@ export default {
align: "center", align: "center",
loadText: "图片上传中,请稍等", loadText: "图片上传中,请稍等",
span: 12, span: 12,
action: process.env.VUE_APP_BASE_API + '/materials/upload', //
// propsHttp: { // // propsHttp: { //
// url: 'picture', // // url: 'picture', //
// name: 'name', // // name: 'name', //
@ -114,12 +116,16 @@ export default {
message: "请上传图片", message: "请上传图片",
trigger: "change", trigger: "change",
}], }],
formatter: (row, column) => { formatter: (row, column) => {
const value = row.picture; const value = row.picture;
if (value === null || value === undefined || value === "") { if (value === null || value === undefined || value === "") {
return "无" return "无"
} }
return value; return value;
},
onSuccess: (res, file, fileList) => {
//
this.form.picture = res.data;
} }
}, },
], ],

@ -165,16 +165,16 @@ export default {
align: "center", align: "center",
dicData: [ dicData: [
{ {
label: "未出库", label: "待审批",
value: 0, value: 2,
}, },
{ {
label: "已出库", label: "已审批",
value: 1, value: 3,
}, },
{ {
label: "已驳回", label: "审批失败",
value: 2, value: 4,
}, },
], ],
}, },

Loading…
Cancel
Save