|
@@ -101,20 +101,20 @@
|
|
|
<el-input type="text" placeholder="请输入二级分类名称" v-model="addChildForm.twoClassify" maxlength="10" show-word-limit style="width: 250px;"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="工单大类" prop="orderType">
|
|
|
- <el-select v-model="addChildForm.orderType" placeholder="请选择工单大类" style="width: 250px;" @change="changeOrderType()">
|
|
|
- <el-option :label="item.name" :value="item.number" v-for="(item, index) in orderMainType" :key="index">
|
|
|
- <span style="color: #8492a6">{{ item.number }}</span>
|
|
|
- <span style="margin-left: 10px;">{{ item.name }}</span>
|
|
|
+ <el-form-item label="工单大类" prop="main">
|
|
|
+ <el-select v-model="addChildForm.main" value-key="categoryId" placeholder="请选择工单大类" style="width: 250px;" @change="changeOrderType">
|
|
|
+ <el-option :label="item.name" :value="item" v-for="(item, index) in orderMainType" :key="index">
|
|
|
+ <!-- <span style="color: #8492a6">{{ item.number }}</span>
|
|
|
+ <span style="margin-left: 10px;">{{ item.name }}</span> -->
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="工单小类" prop="smallType">
|
|
|
- <el-select v-model="addChildForm.smallType" placeholder="请选择工单小类" style="width: 250px;" :disabled="!addChildForm.orderType">
|
|
|
- <el-option :label="item.name" :value="item.id" v-for="(item, index) in orderSmallType" :key="index">
|
|
|
- <span style="color: #8492a6">{{ item.id }}</span>
|
|
|
- <span style="margin-left: 10px;">{{ item.name }}</span>
|
|
|
+ <el-select v-model="addChildForm.small" value-key="categoryId" placeholder="请选择工单小类" style="width: 250px;" :disabled="!addChildForm.main.name">
|
|
|
+ <el-option :label="item.name" :value="item" v-for="(item, index) in orderSmallType" :key="index">
|
|
|
+ <!-- <span style="color: #8492a6">{{ item.id }}</span>
|
|
|
+ <span style="margin-left: 10px;">{{ item.name }}</span> -->
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -168,6 +168,7 @@
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
import { getClassifyList, addClassify, editClassify, deleteClassify, getClassifyDetail, getSmallType } from '@/api/goods'
|
|
|
import { ORDER_MAIN_TYPE } from "@/utils/select_data";
|
|
|
+import { getMainList } from "@/api/workOrder/settlementStandardInstall";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -208,8 +209,8 @@ export default {
|
|
|
addChildForm: {
|
|
|
oneClassify: '',
|
|
|
twoClassify: '',
|
|
|
- orderType: '',
|
|
|
- smallType: '',
|
|
|
+ main: {},
|
|
|
+ small: {},
|
|
|
workOrderType: 'REPAIR',
|
|
|
imgUrl: '',
|
|
|
taxNumber: '',
|
|
@@ -234,7 +235,8 @@ export default {
|
|
|
|
|
|
classifyList: [],
|
|
|
|
|
|
- orderMainType: ORDER_MAIN_TYPE,
|
|
|
+ // orderMainType: ORDER_MAIN_TYPE,
|
|
|
+ orderMainType: [],
|
|
|
orderSmallType: [],
|
|
|
|
|
|
}
|
|
@@ -255,6 +257,12 @@ export default {
|
|
|
this.dataList = res.data;
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ getMainList(){
|
|
|
+ getMainList({type: 2}).then(res => {
|
|
|
+ this.orderMainType = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
// 筛选后重新获取列表
|
|
|
getListByScreen() {
|
|
@@ -318,9 +326,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 改变大类
|
|
|
- changeOrderType() {
|
|
|
- this.addChildForm.smallType = '';
|
|
|
- this.getSmallType();
|
|
|
+ changeOrderType(e) {
|
|
|
+ this.orderSmallType = e.children
|
|
|
+ this.addChildForm.small = {};
|
|
|
+ // this.getSmallType();
|
|
|
},
|
|
|
|
|
|
getSmallType() {
|
|
@@ -334,6 +343,7 @@ export default {
|
|
|
|
|
|
// 打开 新增编辑 二级分类
|
|
|
addOrEditChild(type, cid) {
|
|
|
+ this.getMainList()
|
|
|
this.addChildFormType = type;
|
|
|
this.addChildFormVisible = true;
|
|
|
getClassifyList({name: ''}).then(res => {
|
|
@@ -350,11 +360,16 @@ export default {
|
|
|
if(type == 'edit') {
|
|
|
this.editChildId = cid;
|
|
|
getClassifyDetail({categoryId: cid}).then(res => {
|
|
|
+ this.orderMainType.forEach(item =>{
|
|
|
+ if(item.categoryId == res.data.mainNumber){
|
|
|
+ this.orderSmallType = item.children
|
|
|
+ }
|
|
|
+ })
|
|
|
this.addChildForm = {
|
|
|
oneClassify: res.data.parentId,
|
|
|
twoClassify: res.data.name,
|
|
|
- orderType: Number(res.data.mainNumber),
|
|
|
- smallType: Number(res.data.smallNumber),
|
|
|
+ main: {name: res.data.mainName,categoryId: res.data.mainNumber},
|
|
|
+ small: {name: res.data.smallName,categoryId: res.data.smallNumber},
|
|
|
workOrderType: res.data.workOrderType,
|
|
|
imgUrl: res.data.imgUrl,
|
|
|
taxNumber: res.data.taxNumber,
|
|
@@ -362,7 +377,7 @@ export default {
|
|
|
status: res.data.status,
|
|
|
sort: res.data.sortNum
|
|
|
}
|
|
|
- this.getSmallType();
|
|
|
+ // this.getSmallType();
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -377,21 +392,21 @@ export default {
|
|
|
submitAddChildForm() {
|
|
|
this.$refs.addChildForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- let index = this.$findElem(ORDER_MAIN_TYPE, 'number', this.addChildForm.orderType);
|
|
|
- let mainName = index >= 0 ? ORDER_MAIN_TYPE[index].name : '';
|
|
|
+ // let index = this.$findElem(ORDER_MAIN_TYPE, 'number', this.addChildForm.orderType);
|
|
|
+ // let mainName = index >= 0 ? ORDER_MAIN_TYPE[index].name : '';
|
|
|
|
|
|
- let index2 = this.$findElem(this.orderSmallType, 'id', this.addChildForm.smallType);
|
|
|
- let smallName = index2 >= 0 ? this.orderSmallType[index2].name : '';
|
|
|
+ // let index2 = this.$findElem(this.orderSmallType, 'id', this.addChildForm.smallType);
|
|
|
+ // let smallName = index2 >= 0 ? this.orderSmallType[index2].name : '';
|
|
|
|
|
|
let params = {}
|
|
|
if(this.addChildFormType == 'edit') {
|
|
|
params = {
|
|
|
categoryId: this.editChildId,
|
|
|
name: this.addChildForm.twoClassify,
|
|
|
- mainNumber: this.addChildForm.orderType || '',
|
|
|
- mainName: mainName,
|
|
|
- smallNumber: this.addChildForm.smallType || '',
|
|
|
- smallName: smallName,
|
|
|
+ mainNumber: this.addChildForm.main.categoryId || '',
|
|
|
+ mainName: this.addChildForm.main.name || '',
|
|
|
+ smallNumber: this.addChildForm.small.categoryId || '',
|
|
|
+ smallName: this.addChildForm.small.name,
|
|
|
workOrderType: this.addChildForm.workOrderType,
|
|
|
imgUrl: this.addChildForm.imgUrl,
|
|
|
taxNumber: this.addChildForm.taxNumber,
|
|
@@ -409,8 +424,10 @@ export default {
|
|
|
children: [{
|
|
|
parentId: this.addChildForm.oneClassify,
|
|
|
name: this.addChildForm.twoClassify,
|
|
|
- mainNumber: this.addChildForm.orderType || '',
|
|
|
- mainName: mainName,
|
|
|
+ mainNumber: this.addChildForm.main.categoryId || '',
|
|
|
+ mainName: this.addChildForm.main.name || '',
|
|
|
+ smallNumber: this.addChildForm.small.categoryId || '',
|
|
|
+ smallName: this.addChildForm.small.name,
|
|
|
imgUrl: this.addChildForm.imgUrl,
|
|
|
taxNumber: this.addChildForm.taxNumber,
|
|
|
taxPercent: this.addChildForm.taxPercent,
|