|
|
@@ -18,6 +18,13 @@
|
|
|
@click.stop="openEdit"
|
|
|
>编 辑</el-button>
|
|
|
<el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="!form.id"
|
|
|
+ size="small"
|
|
|
+ @click="pleaseCheck"
|
|
|
+ :loading="btnLoading"
|
|
|
+ >请核</el-button>
|
|
|
+ <el-button
|
|
|
type="success"
|
|
|
:disabled="!form.id"
|
|
|
size="small"
|
|
|
@@ -41,9 +48,9 @@
|
|
|
v-model="form"
|
|
|
:option="option"
|
|
|
>
|
|
|
- <template slot="createUser">
|
|
|
+ <template slot="applyUser">
|
|
|
<el-select
|
|
|
- v-model="form.createUser"
|
|
|
+ v-model="form.applyUser"
|
|
|
filterable
|
|
|
clearable
|
|
|
size="small"
|
|
|
@@ -52,17 +59,17 @@
|
|
|
v-for="(item,index) in userList"
|
|
|
:key="index"
|
|
|
:label="item.realName"
|
|
|
- :value="item.realName"
|
|
|
+ :value="item.id"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
- <template slot="deptId">
|
|
|
+ <template slot="applyDept">
|
|
|
<avue-input-tree
|
|
|
leaf-only
|
|
|
style="width: 100%;"
|
|
|
size="small"
|
|
|
:props="{ label: 'title' }"
|
|
|
- v-model="form.deptId"
|
|
|
+ v-model="form.applyDept"
|
|
|
placeholder=" "
|
|
|
type="tree"
|
|
|
:dic="dic"
|
|
|
@@ -322,9 +329,16 @@ import { gainUser } from "@/api/basicData/customerInquiry";
|
|
|
import {getUserInfo} from "@/api/system/user";
|
|
|
import {getDeptTree} from "@/api/system/dept";
|
|
|
import { getCurrentDate } from "@/util/date";
|
|
|
+import {dataDetail, typeSave, removeGoods, pleaseCheck} from "@/api/officeSupplies/purchaseApply";
|
|
|
+import { contrastObj, contrastList } from "@/util/contrastData";
|
|
|
|
|
|
export default {
|
|
|
name: "detail",
|
|
|
+ props: {
|
|
|
+ detailData: {
|
|
|
+ type: Object
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
pageLoading: false,
|
|
|
@@ -336,7 +350,7 @@ export default {
|
|
|
column: [
|
|
|
{
|
|
|
label: "申请人",
|
|
|
- prop: "createUser",
|
|
|
+ prop: "applyUser",
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
|
@@ -349,7 +363,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "申请部门",
|
|
|
- prop: "deptId",
|
|
|
+ prop: "applyDept",
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
|
@@ -362,7 +376,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "申请时间",
|
|
|
- prop: "b",
|
|
|
+ prop: "applyTime",
|
|
|
span: 8,
|
|
|
type: "date",
|
|
|
format: "yyyy-MM-dd",
|
|
|
@@ -446,6 +460,8 @@ export default {
|
|
|
total: 0
|
|
|
},
|
|
|
dic: [],
|
|
|
+ oldForm: {},
|
|
|
+ oldDataList: [],
|
|
|
}
|
|
|
},
|
|
|
async created() {
|
|
|
@@ -457,15 +473,24 @@ export default {
|
|
|
this.getColumnName(90),
|
|
|
goodsOption
|
|
|
);
|
|
|
- getGoods(1, 500).then(res => {
|
|
|
- this.goodsoptions = res.data.data.records;
|
|
|
+ getGoods(1, 10).then(res => {
|
|
|
+ if (res.data.data.total > 0) {
|
|
|
+ this.goodsoptions = res.data.data.records;
|
|
|
+ if (Math.ceil(res.data.data.total / 10) > 1) {
|
|
|
+ for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
|
|
|
+ getGoods(i, 10).then(e => {
|
|
|
+ this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
gainUser().then(res => {
|
|
|
this.userList = res.data.data;
|
|
|
});
|
|
|
getUserInfo().then(res => {
|
|
|
- this.$set(this.form, 'createUser', res.data.data.realName);
|
|
|
- this.$set(this.form, 'deptId', res.data.data.deptId);
|
|
|
+ this.$set(this.form, 'applyUser', res.data.data.id);
|
|
|
+ this.$set(this.form, 'applyDept', res.data.data.deptId);
|
|
|
})
|
|
|
getDeptTree().then(res => {
|
|
|
this.dic = res.data.data
|
|
|
@@ -473,7 +498,14 @@ export default {
|
|
|
this.getWorkDicts('unit').then(res => {
|
|
|
this.unitOption = res.data.data;
|
|
|
})
|
|
|
- this.$set(this.form, 'b', getCurrentDate()); // 默认当前日期
|
|
|
+ this.$set(this.form, 'applyTime', getCurrentDate()); // 默认当前日期
|
|
|
+ if (this.detailData.query) {
|
|
|
+ this.disabled = true;
|
|
|
+ // this.option.column.map(e => {
|
|
|
+ // this.$set(e, 'disabled', true)
|
|
|
+ // })
|
|
|
+ this.queryData(this.detailData.id);
|
|
|
+ }
|
|
|
},
|
|
|
filters: {
|
|
|
IntegerFormat(num) {
|
|
|
@@ -484,6 +516,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 查询
|
|
|
+ queryData(id) {
|
|
|
+ this.pageLoading = true;
|
|
|
+ dataDetail(id).then(res => {
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
|
|
|
+ this.oldForm = {...this.form};
|
|
|
+ this.oldDataList = [...this.dataList];
|
|
|
+ delete this.form.orderItemsList;
|
|
|
+ }).finally(() => {
|
|
|
+ this.pageLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
//返回列表
|
|
|
backToList() {
|
|
|
this.$emit("goBack");
|
|
|
@@ -499,13 +544,16 @@ export default {
|
|
|
this.$refs["form"].validate((valid, done) => {
|
|
|
done();
|
|
|
if (valid) {
|
|
|
- // this.btnLoading = true;
|
|
|
- // typeSave(this.form).then(res => {
|
|
|
- // this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
|
|
|
- // this.queryData(res.data.data.id);
|
|
|
- // }).finally(() => {
|
|
|
- // this.btnLoading = false;
|
|
|
- // })
|
|
|
+ this.btnLoading = true;
|
|
|
+ this.form.billType = 'CG';
|
|
|
+ this.form.tradeType = 'OCG';
|
|
|
+ this.$set(this.form, 'orderItemsList', this.dataList);
|
|
|
+ typeSave(this.form).then(res => {
|
|
|
+ this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
|
|
|
+ this.queryData(res.data.data);
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ })
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
@@ -567,13 +615,13 @@ export default {
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
if (row.id) {
|
|
|
- // removeGoods(row.id).then(res => {
|
|
|
- // this.$message({
|
|
|
- // type: 'success',
|
|
|
- // message: '删除成功!'
|
|
|
- // })
|
|
|
- // this.dataList.splice(row.$index, 1);
|
|
|
- // })
|
|
|
+ removeGoods(row.id).then(res => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ })
|
|
|
+ this.dataList.splice(row.$index, 1);
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
@@ -773,6 +821,45 @@ export default {
|
|
|
}
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
+ // 请核
|
|
|
+ pleaseCheck() {
|
|
|
+ if (this.verification()) {
|
|
|
+ const data = {
|
|
|
+ id : this.form.id,
|
|
|
+ checkType: 'bgyp',
|
|
|
+ url: '/workManagement/purchaseApply/index',
|
|
|
+ pageStatus:"this.$store.getters.officePurchaseStatus",
|
|
|
+ pageLabel:"采购申请",
|
|
|
+ checkFlag: 1,
|
|
|
+ }
|
|
|
+ this.btnLoading = true;
|
|
|
+ pleaseCheck(data).then(res => {
|
|
|
+ this.$message.success('请核成功')
|
|
|
+ this.queryData(this.form.id)
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('请核失败')
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 验证新旧值对比
|
|
|
+ verification() {
|
|
|
+ if (contrastObj(this.form, this.oldForm) ||
|
|
|
+ contrastList(this.dataList, this.oldDataList)) {
|
|
|
+ this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ this.editCustomer();
|
|
|
+ }).catch(() => {
|
|
|
+ return false; //取消改动数据
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|