@@ -901,6 +1031,7 @@ import CustomSVPPS from '@/components/CustomFormComponents/SVPPS' import CustomRoleTree from '@/components/CustomFormComponents/roleTree' import CustomDatePickWithText2 from '@/components/CustomFormComponents/DatePickerWithText2' import { interfaceUrl } from "@/sysConfig"; +import TreeSelect from '@/components/treeSelect/treeSelect.vue'; export default { name: 'foreignStandardsAndRegulations', @@ -920,7 +1051,8 @@ export default { CustomDatePickWithText, CustomSVPPS, CustomRoleTree, - CustomDatePickWithText2 + CustomDatePickWithText2, + TreeSelect }, data () { return { @@ -929,6 +1061,15 @@ export default { label: 'menuName', children: 'children' }, + defaultProps: { + children: 'children', + label: 'menuName' + }, + nodeKey: 'id', + defaultCheckedKeys: [], + productModal: false, // 模态框是否打开 + modalType: '', + productTitle: '', // 模态框标题 menuTreeLoading: true, orderBy:'', nowOrder:'', @@ -1004,6 +1145,11 @@ export default { countryOptions: [], regionOptions: [], // 区域 standSortOptions: [], // 标准类别下拉框 + standSystemOptions: [], // 标准体系下拉框 + sycpxOptions: [], // 适用产品线下拉框 + zrbmOptions: [], // 责任部门下拉框 + zrgcsOptions: [], // 责任工程师下拉框 + txlbOptions: [], // 体系类别下拉框 standSortConfigOptions: [], // 标准类别下拉框 applyArcticOptions: [], // 适用车型下拉框 standStateOptions: [], // 标准状态下拉框 @@ -1229,6 +1375,52 @@ export default { menuModalTitle: '', menuModalFlag: false, deleteMenuModal: false, + // 规范 + productRules: { + menuName: [ + {required: true, message: '一级菜单不能为空', trigger: 'blur'}, + {type: 'string', max: 100, message: '最多输入100位', trigger: 'blur'} + ], + displaySeq: [ + {type: 'number', required: true, message: '排序号不能为空且为正整数', trigger: 'blur'}, + {type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'} + ], + remarks: [ + {type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'} + ], + dicTypeName: [ + {required: true, message: '选项不能为空', trigger: 'blur'}, + {type: 'string', max: 100, message: '最多输入100位', trigger: 'blur'} + ], + showIndex: [ + {type: 'number', required: true, message: '排序号不能为空且为正整数', trigger: 'blur'}, + {type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'} + ], + describes: [ + {type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'} + ] + }, + productModelAdd: { + id : "", + sorDivide : "FOREIGN_STAND", + menuName : "", + parentId : null, + parentIds : null, + parentIdsName : "", + displaySeq : "", + validFlag : "", + creationTime : "", + modifyTime : "", + remarks : "", + children : [], + // 模态框信息 + dicTypeName: '', + showIndex: '', + // 描述 + describes: '', + // 唯一辨识 + dicId: "" + }, sarMenu: { id: '', parentId: '', @@ -1454,6 +1646,77 @@ export default { watch: { }, methods: { + popoverHide (checkedIds, checkedData) { + console.log(checkedIds); + console.log(checkedData); + this.sarStandardsInfoEO.standSystem = checkedData.id + console.log(this.sarStandardsInfoEO.standSystem); + }, + closeModal () { + this.productModal = false + this.closeDrawer() + }, + // 提交新增/修改 + saveProduct (name) { + this.$refs[name].validate((valid) => { + if (valid) { + if (this.modalType === 1) { + this.$http.postData('sarResource/ts-resource/add', this.productModelAdd, { + _this: this + }, res => { + if (res.ok) { + this.selectMenu() + this.productModal = false + this.productModelAdd = { + // 模态框信息 + dicTypeName: '', + showIndex: '', + // 描述 + describes: '', + // 唯一辨识 + dicId: this.$route.params.id + } + } else { + this.productModal = true + } + }, e => {}) + } else if (this.modalType === 2) { + this.$http.putData('sarResource/ts-resource', this.productModelAdd, { + _this: this + }, res => { + this.selectMenu() + this.productModal = false + this.productModelAdd = { + // 模态框信息 + dicTypeName: '', + showIndex: '', + // 描述 + describes: '', + // 唯一辨识 + dicId: this.$route.params.id + } + }, e => { + }) + } + } else { + } + }) + }, + closeDrawer () { + this.$nextTick(() => { + this.$refs['productModelAdd'].resetFields() + this.productModelAdd = { + // 模态框信息 + dicTypeName: '', + showIndex: '', + // 描述 + describes: '', + // 唯一辨识 + dicId: this.$route.params.id + } + }) + this.productModal = false + }, // 树点击 isTreeOk (checkedList) { this.shareStandardSelect = [] @@ -1596,6 +1859,7 @@ export default { const [displayLocation] = values const formFieldList = this.formFieldList this.sarStandardsInfoEO = JSON.parse(JSON.stringify(item)) + this.defaultCheckedKeys = [this.sarStandardsInfoEO.standSystem]; this.sarStandardsInfoEO.standSort = item.standSort if (this.sarStandardsInfoEO.putTime != null && this.sarStandardsInfoEO.putTime !== '') { this.sarStandardsInfoEO.putTime = this.sarStandardsInfoEO.putTime.replace(new RegExp(/-/gm), '/') @@ -1639,6 +1903,112 @@ export default { }) }) }, + // 查询二级菜单 + selectChildMenu (row) { + this.$http.get('sarResource/ts-resource/getMenuById', { + menuId: row.id + }, {}, res => { + if (res.ok) { + if(this.modalType === 1){ + let idsName = "" + if(row.parentIds !== null){ + if(row.parentIds.indexOf(res.data.id) != -1){ + this.productModelAdd.parentIds = row.parentIds + }else { + this.productModelAdd.parentIds = row.parentIds + ',' + res.data.id + idsName = row.parentIdsName + ',' + res.data.menuName + } + }else { + this.productModelAdd.parentIds = res.data.id + idsName = res.data.menuName; + } + this.productModelAdd.parentId = res.data.id + this.productModelAdd.parentIdsName = idsName + this.$forceUpdate() + }else { + this.productModelAdd = res.data + } + } + }) + }, + update(data) { + this.modalType = 2 + this.selectChildMenu(data) + this.productModal = true + // 取消所有的选中效果 + this.handleSelectAll(false) + this.productTitle = '编辑信息' + // const newChild = { id: this.id++, label: 'testtest', children: [] }; + // if (!data.children) { + // this.$set(data, 'children', []); + // } + // data.children.push(newChild); + }, + + append(data) { + this.modalType = 1 + this.selectChildMenu(data) + this.productModal = true + // 取消所有的选中效果 + this.handleSelectAll(false) + this.productTitle = '新增下级菜单信息' + this.productModelAdd.dicTypeCode = '' + // const newChild = { id: this.id++, label: 'testtest', children: [] }; + // if (!data.children) { + // this.$set(data, 'children', []); + // } + // data.children.push(newChild); + }, + + remove(node, data) { + this.$confirm('是否删除菜单?', '提示', { + confirmButtonText: '确定', + confirmButtonClass: 'common-button-primary', + cancelButtonText: '取消', + roundButton: true, + type: 'warning' + }).then(() => { + this.$http.delete("sarResource/ts-resource", { + menuId: data.id + }, res => { + }, e => { + if(e.ok){ + this.$message({ + type: 'success', + message: "删除成功" + }) + this.selectMenu() + }else { + this.$message({ + type: 'warning', + message: e.message + }) + } + }) + }).catch(() => { + this.$refs.selections.clearSelection() + this.$message({ + type: 'info', + message: '已取消删除' + }) + }) + // const parent = node.parent; + // const children = parent.data.children || parent.data; + // const index = children.findIndex(d => d.id === data.id); + // children.splice(index, 1); + }, + // 树节点鼠标移入移出 + mouseenter(data){ + console.log(data) + this.$set(data, 'show', true) + if(data.parentId !== null){ + this.$set(data, 'showDel', true) + } + }, + mouseleave(data){ + this.$set(data, 'show', false) + this.$set(data, 'showDel', false) + }, treeClick (treeNode) { this.selectSarMenu = treeNode this.standCommonlySearch.menuId = treeNode.id @@ -2193,7 +2563,7 @@ export default { // return this.$message.warning('实施日期必须有一项为日期格式') // } this.isSubmit = true - this.$http.postData(this.addOrUPdateFlag === 1 ? 'lawss/sarStandardsInfo/addarStandardsInfo' : 'lawss/sarStandardsInfo/updateSarStandardsInfo', nowstandinfo, { + this.$http.postData(this.addOrUPdateFlag === 1 ? 'sarStandardsInfo/sar-standards-info/addarStandardsInfo' : 'sarStandardsInfo/sar-standards-info/updateSarStandardsInfo', nowstandinfo, { _this: this }, res => { this.isSubmit = false @@ -3414,16 +3784,21 @@ export default { _this: this }, res => { this.allSelectOptions = res.data || {} + this.standSortOptions = res.data.STANDCLASSIFY // 标准类别 + this.standNatureOptions = res.data.SARPROPERTY // 标准性质 + this.standStateOptions = res.data.WBZTCLASS // 文本状态 + this.standSystemOptions = res.data.BZTXCLASS // 标准体系 + this.categoryOptions = res.data.NYLXCLASS // 能源类型 + this.applyAuthOptions = res.data.SYRZCLASS // 适用认证 + this.sycpxOptions = res.data.SYCPXCLASS // 适用产品线 + this.zrbmOptions = res.data.ZRBMCLASS // 责任部门 + this.zrgcsOptions = res.data.ZRGCSCLASS // 责任工程师 + this.txlbOptions = res.data.TXLBCLASS // 体系类别 this.countryOptions = res.data.COUNTRY this.regionOptions = res.data.REGION // 区域 - this.standSortOptions = res.data.STANDCLASSIFY this.applyArcticOptions = res.data.PRODUCTTYPE // 根据需求文档,产品类别对应标准属性中的“适用车型” - this.standStateOptions = res.data.STANDSTATE - this.standNatureOptions = res.data.SARPROPERTY // 标准性质 this.adoptExtentOptions = res.data.DEGREESTANDARD this.emergyKindOptions = res.data.ENERGYTYPES - this.applyAuthOptions = res.data.PROVETYPE // 适用认证下拉框 - this.categoryOptions = res.data.CATEGORY // 能源种类 this.assemClassOptions = res.data.ASSEMCLASSIFY // 总成分类 this.categoryConfigOptions = res.data.CATEGORY this.standAttributeList = res.data.RULETYPE