|
|
@@ -26,14 +26,20 @@
|
|
|
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="编码" prop="code">
|
|
|
- <el-input
|
|
|
+ <!-- <el-input
|
|
|
v-if="ruleCode == '自定义'"
|
|
|
v-model="form.code"
|
|
|
readonly
|
|
|
@click.native="openCode"
|
|
|
:disabled="status == 0"
|
|
|
- />
|
|
|
- <el-input v-else v-model="form.code" :disabled="status == 0" />
|
|
|
+ /> -->
|
|
|
+ <el-input v-model="form.code" :disabled="status == 0">
|
|
|
+ <template slot="append" v-if="status != 0">
|
|
|
+ <el-link :underline="false" @click.native="getCodeOpen"
|
|
|
+ >申请编码
|
|
|
+ </el-link></template
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -356,12 +362,12 @@
|
|
|
</el-card>
|
|
|
|
|
|
<!-- 自定义编码 -->
|
|
|
- <CodeDialog
|
|
|
+ <!-- <CodeDialog
|
|
|
ref="codeRefs"
|
|
|
v-if="codeShow"
|
|
|
@close="codeShow = false"
|
|
|
@chooseCode="chooseCode"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
<!-- 分类选择弹窗 -->
|
|
|
<CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
|
|
|
<!-- 仓储配置 -->
|
|
|
@@ -406,6 +412,9 @@
|
|
|
:categoryLevelGroupId="form.categoryLevelGroupId"
|
|
|
:code="form.code"
|
|
|
/>
|
|
|
+ <!-- 申请编码 -->
|
|
|
+
|
|
|
+ <GetCodeDialog ref="GetCodeDialogRef" @setCode="setCode"></GetCodeDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -413,7 +422,7 @@
|
|
|
import SalesInfos from './components/SalesInfos.vue';
|
|
|
import PurchasingInfo from './components/PurchasingInfo.vue';
|
|
|
import GroupDialog from './components/GroupDialog.vue';
|
|
|
- import CodeDialog from './components/codeDialog.vue';
|
|
|
+ // import CodeDialog from './components/codeDialog.vue';
|
|
|
import CategoryDialog from './components/CategoryDialog.vue';
|
|
|
import WarehouseInfo from './components/WarehouseInfo.vue';
|
|
|
import ProcureInfo from './components/ProcureInfo.vue';
|
|
|
@@ -431,7 +440,7 @@
|
|
|
import { getDetails } from '@/api/classifyManage/itemInformation';
|
|
|
import { getByCode } from '@/api/system/dictionary-data';
|
|
|
import {
|
|
|
- getCode,
|
|
|
+ // getCode,
|
|
|
rootCategoryCode,
|
|
|
fieldModel,
|
|
|
checkExist
|
|
|
@@ -443,6 +452,8 @@
|
|
|
import { produceTypeList } from '@/enum/dict.js';
|
|
|
import { copyObj } from '@/utils/util';
|
|
|
import { parameterGetByCode } from '@/api/system/dictionary/index.js';
|
|
|
+ import GetCodeDialog from '@/components/addDoc/getCode.vue';
|
|
|
+ import { getCode, listCode } from '@/components/addDoc/api/index.js';
|
|
|
const defCategoryQms = [
|
|
|
{
|
|
|
categoryId: '',
|
|
|
@@ -517,7 +528,8 @@
|
|
|
MoldInfo,
|
|
|
RemarkInfo,
|
|
|
CategoryDialog,
|
|
|
- CodeDialog
|
|
|
+ // CodeDialog,
|
|
|
+ GetCodeDialog
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -806,11 +818,13 @@
|
|
|
this.form.categoryLevelPathId = this.$route.query.categoryLevelPathId;
|
|
|
|
|
|
this.ruleCode = this.$route.query.ruleCode;
|
|
|
- if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
|
|
|
- const code = await getCode(this.ruleCode);
|
|
|
- this.$set(this.form, 'code', code);
|
|
|
+ // if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
|
|
|
+ // const code = await getCode(this.ruleCode);
|
|
|
+ // this.$set(this.form, 'code', code);
|
|
|
+ // }
|
|
|
+ if (this.status != 0) {
|
|
|
+ this.getCode();
|
|
|
}
|
|
|
-
|
|
|
this.getFieldModel();
|
|
|
|
|
|
// this.getDictList('zeroPartPros');
|
|
|
@@ -859,11 +873,13 @@
|
|
|
);
|
|
|
this.status = this.$route.query.status;
|
|
|
this.ruleCode = this.$route.query.ruleCode;
|
|
|
- if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
|
|
|
- const code = await getCode(this.ruleCode);
|
|
|
- this.$set(this.form, 'code', code);
|
|
|
+ // if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
|
|
|
+ // const code = await getCode(this.ruleCode);
|
|
|
+ // this.$set(this.form, 'code', code);
|
|
|
+ // }
|
|
|
+ if (this.status != 0) {
|
|
|
+ this.getCode();
|
|
|
}
|
|
|
-
|
|
|
this.getFieldModel();
|
|
|
this.getAttributeList('inventory_type');
|
|
|
|
|
|
@@ -1162,9 +1178,6 @@
|
|
|
},
|
|
|
// 确定分类
|
|
|
async confirmCategory(node, title, PathInfo, ruleCode) {
|
|
|
- if (this.status != 0) {
|
|
|
- this.$set(this.form, 'code', null);
|
|
|
- }
|
|
|
this.categoryLevelPathId = PathInfo.categoryLevelPathId.split(',')[0];
|
|
|
|
|
|
if (title == '选择产品分类') {
|
|
|
@@ -1179,16 +1192,54 @@
|
|
|
|
|
|
this.ruleCode = ruleCode;
|
|
|
|
|
|
- if (ruleCode && ruleCode != '自定义' && this.status != 0) {
|
|
|
- const code = await getCode(ruleCode);
|
|
|
- this.$set(this.form, 'code', code);
|
|
|
+ // if (ruleCode && ruleCode != '自定义' && this.status != 0) {
|
|
|
+ // const code = await getCode(ruleCode);
|
|
|
+ // this.$set(this.form, 'code', code);
|
|
|
+ // }
|
|
|
+ // console.log(this.form, 'this.form');
|
|
|
+ if (this.status != 0) {
|
|
|
+ this.getCode();
|
|
|
}
|
|
|
- console.log(this.form, 'this.form');
|
|
|
}
|
|
|
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
|
|
|
+ getCodeOpen() {
|
|
|
+ let parentId = [];
|
|
|
+ if (this.form.categoryLevelPathId?.length) {
|
|
|
+ parentId = this.form.categoryLevelPathId?.split(',');
|
|
|
+ }
|
|
|
+ this.$refs.GetCodeDialogRef.open({
|
|
|
+ id: this.form.categoryLevelId,
|
|
|
+ parentId: parentId.length > 1 ? parentId[parentId.length - 2] : ''
|
|
|
+ });
|
|
|
+ },
|
|
|
+ setCode(val) {
|
|
|
+ this.$set(this.form, 'code', val);
|
|
|
+ },
|
|
|
+
|
|
|
+ async getCode() {
|
|
|
+ let parentId = [];
|
|
|
+ let categoryLevelPathId = this.PathInfo?.categoryLevelPathId
|
|
|
+ ? this.PathInfo.categoryLevelPathId
|
|
|
+ : this.form.categoryLevelPathId;
|
|
|
+ if (categoryLevelPathId?.length) {
|
|
|
+ parentId = categoryLevelPathId.split(',');
|
|
|
+ }
|
|
|
+ const options = await listCode({
|
|
|
+ id: this.form.categoryLevelId,
|
|
|
+ parentId: parentId.length > 1 ? parentId[parentId.length - 2] : ''
|
|
|
+ });
|
|
|
+ if (options.length > 0) {
|
|
|
+ getCode({
|
|
|
+ categoryId: options[0].id
|
|
|
+ }).then((res) => {
|
|
|
+ this.$set(this.form, 'code', res.codeStr);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
async getDictList(code) {
|
|
|
let { data: res } = await getByCode(code);
|
|
|
|