|
@@ -13,8 +13,13 @@
|
|
|
<el-form-item label="盘点公司" prop="wsm_supplier">
|
|
|
<search-supplier
|
|
|
:value="ruleForm.wsm_supplier"
|
|
|
- :disabled="status !== '0'"
|
|
|
- :isDetail="id !== 'add'"
|
|
|
+ :disabled="
|
|
|
+ !(
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ )
|
|
|
+ "
|
|
|
+ :is-detail="id !== 'add'"
|
|
|
:placeholder="'请选择盘点公司'"
|
|
|
:names="companyName"
|
|
|
@searchChange="supplierChange"
|
|
@@ -25,8 +30,13 @@
|
|
|
<el-form-item label="盘点仓库" prop="wsm_code">
|
|
|
<search-stock
|
|
|
:value="ruleForm.wsm_code"
|
|
|
- :isDetail="true"
|
|
|
- :disabled="status !== '0'"
|
|
|
+ :disabled="
|
|
|
+ !(
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ )
|
|
|
+ "
|
|
|
+ :is-detail="id !== 'add'"
|
|
|
:placeholder="'请选择盘点仓库'"
|
|
|
:isRelation="true"
|
|
|
:companyCode="companyCode"
|
|
@@ -40,7 +50,12 @@
|
|
|
<el-select
|
|
|
v-model="ruleForm.type"
|
|
|
placeholder="请选择盘点类型"
|
|
|
- :disabled="status !== '0'"
|
|
|
+ :disabled="
|
|
|
+ !(
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ )
|
|
|
+ "
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option
|
|
@@ -54,29 +69,37 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24" style="text-align: right">
|
|
|
- <el-button
|
|
|
- @click="deleteById()"
|
|
|
- plain
|
|
|
- v-if="status !== '4'"
|
|
|
- type="danger"
|
|
|
- >作废盘点申请
|
|
|
- </el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- v-if="status === '1'"
|
|
|
- plain
|
|
|
@click="submitForm"
|
|
|
- >取消流程
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" @click="submitForm" v-if="status === '0'"
|
|
|
+ v-if="
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ "
|
|
|
>保 存
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- @click="submitForm(true)"
|
|
|
- v-if="status === '0'"
|
|
|
- >保存并发起流程
|
|
|
+ @click="statusConfirm('1', '发起审核流程')"
|
|
|
+ v-if="status === '0' && powers.some((item) => item == '012')"
|
|
|
+ >发起审核流程
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('0', '取消审核流程')"
|
|
|
+ plain
|
|
|
+ v-if="status === '1' && powers.some((item) => item == '014')"
|
|
|
+ >取消审核流程</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('-1', '作废该条信息')"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ v-if="
|
|
|
+ (status === '0' || status === '1') &&
|
|
|
+ powers.some((item) => item == '015')
|
|
|
+ "
|
|
|
+ >作废该条信息</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
@@ -95,6 +118,19 @@ export default {
|
|
|
name: "addEdit",
|
|
|
props: ["id"],
|
|
|
mixins: [resToken],
|
|
|
+ computed: {
|
|
|
+ powers() {
|
|
|
+ let tran =
|
|
|
+ this.$store.getters.btnList.find(
|
|
|
+ (item) => item.menu_route == "checkDetail"
|
|
|
+ ) || {};
|
|
|
+ if (tran && tran.action && tran.action.length > 0) {
|
|
|
+ return tran.action;
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
status: "0",
|
|
@@ -103,14 +139,14 @@ export default {
|
|
|
loading: false,
|
|
|
showGoodsModel: false,
|
|
|
typeList: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "全盘",
|
|
|
- },
|
|
|
{
|
|
|
value: "2",
|
|
|
label: "抽盘",
|
|
|
},
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "全盘",
|
|
|
+ },
|
|
|
],
|
|
|
columns: columns,
|
|
|
ruleForm: {
|
|
@@ -162,6 +198,59 @@ export default {
|
|
|
closeModel() {
|
|
|
console.log("closeModel!!");
|
|
|
},
|
|
|
+ async statusConfirm(status, message) {
|
|
|
+ await this.$confirm(`确定要${message}?`, {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ if (status === "-1") {
|
|
|
+ await this.deleteById(message);
|
|
|
+ } else {
|
|
|
+ await this.setStatus(status, message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ console.log("取消");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async deleteById(message) {
|
|
|
+ const res = await asyncRequest.delete({ id: this.id });
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: message + "成功!",
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ this.routeGoto("check", {});
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async setStatus(status, message) {
|
|
|
+ let model = {
|
|
|
+ id: this.id,
|
|
|
+ remark: "",
|
|
|
+ status: status,
|
|
|
+ };
|
|
|
+ const res = await asyncRequest.status(model);
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: message + "成功!",
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+ this.initForm();
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
//供应商选择
|
|
|
supplierChange(e) {
|
|
|
if (e && e.id) {
|
|
@@ -184,33 +273,6 @@ export default {
|
|
|
}
|
|
|
this.$refs.ruleForm.validateField("wsm_code");
|
|
|
},
|
|
|
- async deleteById() {
|
|
|
- await this.$confirm("确定要作废?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- const model = {
|
|
|
- id: this.id,
|
|
|
- };
|
|
|
- const res = await asyncRequest.delete(model);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: "作废成功!",
|
|
|
- message: "",
|
|
|
- });
|
|
|
- this.routeGoto("check", {});
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
- });
|
|
|
- },
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
if (this.id === "add") {
|
|
@@ -227,10 +289,10 @@ export default {
|
|
|
async initData() {
|
|
|
const res = await asyncRequest.detail({ id: this.id });
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
- const { status, type, wsm_code } = res.data;
|
|
|
+ const { status, type, wsm_code,supplierNo,supplier_name } = res.data;
|
|
|
this.status = status;
|
|
|
- this.companyCode = "GYS-20210517-0009";
|
|
|
- this.companyName = "北京长跃科技发展有限公司";
|
|
|
+ this.companyCode = supplierNo;
|
|
|
+ this.companyName = supplier_name;
|
|
|
this.ruleForm = {
|
|
|
wsm_code: [wsm_code],
|
|
|
type: type,
|
|
@@ -261,13 +323,11 @@ export default {
|
|
|
let arr = JSON.parse(JSON.stringify(list));
|
|
|
return arr.join(",");
|
|
|
},
|
|
|
- async submitForm(status) {
|
|
|
+ async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
- const { wsm_code, type, good_type_code } = JSON.parse(
|
|
|
- JSON.stringify(this.ruleForm)
|
|
|
- );
|
|
|
+ const { wsm_code, type } = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
const model = {
|
|
|
id: this.id,
|
|
|
wsm_code: this.getId(wsm_code) || "", // 盘点仓库
|
|
@@ -288,9 +348,9 @@ export default {
|
|
|
message: "",
|
|
|
});
|
|
|
// 刷新
|
|
|
- this.$emit("refresh");
|
|
|
- if (status) {
|
|
|
- await this.setProcess("1");
|
|
|
+ if (this.id === "add") {
|
|
|
+ this.showModelThis = false;
|
|
|
+ this.$emit("refresh", false);
|
|
|
}
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|