|
@@ -36,15 +36,9 @@
|
|
|
</el-form-item>
|
|
|
<div>
|
|
|
<el-form-item label="类别:" prop="chemicalCategory" label-width="130px">
|
|
|
- <!--<el-select v-model="dialogForm.chemicalCategory" placeholder="请选择类别" style="width: 245px">-->
|
|
|
- <!--<el-option-->
|
|
|
- <!--v-for="dict in categoryOptions"-->
|
|
|
- <!--:key="dict.value"-->
|
|
|
- <!--:label="dict.label"-->
|
|
|
- <!--:value="dict.value"-->
|
|
|
- <!--/>-->
|
|
|
- <!--</el-select>-->
|
|
|
<el-cascader
|
|
|
+ ref="addCascader"
|
|
|
+ @change="addHandleChange"
|
|
|
style="width:245px;"
|
|
|
v-model="dialogForm.chemicalCategory"
|
|
|
:options="categoryOptions"
|
|
@@ -126,7 +120,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { getDicts } from "@/api/commonality/noPermission";
|
|
|
- import { chemicalChemicalAdd,chemicalChemicalUpdate,chemicalChemicalDetail } from "@/api/chemicalManage/index";
|
|
|
+ import { chemicalChemicalAdd,chemicalChemicalUpdate,chemicalChemicalDetail,systemDictChemicalType } from "@/api/chemicalManage/index";
|
|
|
export default {
|
|
|
name: 'addChemicals',
|
|
|
data () {
|
|
@@ -141,7 +135,7 @@
|
|
|
stateOfMatter:[],
|
|
|
dialogForm:{
|
|
|
chemicalName:null,
|
|
|
- chemicalCategory:"1",
|
|
|
+ chemicalCategory:[],
|
|
|
chemicalLevel:1,
|
|
|
casNum:null,
|
|
|
anotherName:null,
|
|
@@ -184,7 +178,7 @@
|
|
|
this.initialize();
|
|
|
this.$set(this,'dialogForm',{
|
|
|
chemicalName:null,
|
|
|
- chemicalCategory:'1',
|
|
|
+ chemicalCategory:[],
|
|
|
chemicalLevel:1,
|
|
|
casNum:null,
|
|
|
anotherName:null,
|
|
@@ -197,10 +191,9 @@
|
|
|
this.$set(this,'lookImgDialogType',true);
|
|
|
}else if(type == 2){
|
|
|
chemicalChemicalDetail({chemicalId:row.chemicalId}).then(response => {
|
|
|
- this.$set(this,'dialogForm',{
|
|
|
+ let obj = {
|
|
|
chemicalId:row.chemicalId,
|
|
|
chemicalName:response.data.chemicalName,
|
|
|
- chemicalCategory:response.data.chemicalCategory,
|
|
|
chemicalLevel:response.data.chemicalLevel,
|
|
|
casNum:response.data.casNum,
|
|
|
anotherName:response.data.anotherName,
|
|
@@ -209,7 +202,13 @@
|
|
|
depositRequire:response.data.depositRequire+'',
|
|
|
depositUnit:response.data.depositUnit,
|
|
|
relativeDensity:response.data.relativeDensity,
|
|
|
- });
|
|
|
+ };
|
|
|
+ if(response.data.chemicalCategoryClass){
|
|
|
+ obj.chemicalCategory = [response.data.chemicalCategory,response.data.chemicalCategoryClass]
|
|
|
+ }else{
|
|
|
+ obj.chemicalCategory = [response.data.chemicalCategory]
|
|
|
+ }
|
|
|
+ this.$set(this,'dialogForm',obj);
|
|
|
this.$set(this,'lookImgDialogTitle','编辑');
|
|
|
this.$set(this,'lookImgDialogType',true);
|
|
|
});
|
|
@@ -222,32 +221,8 @@
|
|
|
//初始化
|
|
|
initialize(){
|
|
|
//化学品类别字典
|
|
|
- getDicts('chemicals_category').then(response => {
|
|
|
- // this.$set(this,'categoryOptions',response.data);
|
|
|
- this.$set(this,'categoryOptions',[
|
|
|
- {
|
|
|
- value: '1',
|
|
|
- label: '1',
|
|
|
- children:[{
|
|
|
- value: '1-1',
|
|
|
- label: '1-1',
|
|
|
- },{
|
|
|
- value: '1-2',
|
|
|
- label: '1-2',
|
|
|
- }],
|
|
|
- },
|
|
|
- {
|
|
|
- value: '2',
|
|
|
- label: '2',
|
|
|
- children:[{
|
|
|
- value: '2-1',
|
|
|
- label: '2-1',
|
|
|
- },{
|
|
|
- value: '2-2',
|
|
|
- label: '2-2',
|
|
|
- }],
|
|
|
- }
|
|
|
- ]);
|
|
|
+ systemDictChemicalType({dictCode:'chemicals_category'}).then(response => {
|
|
|
+ this.$set(this,'categoryOptions',response.data);
|
|
|
});
|
|
|
//存放单位
|
|
|
getDicts('storage_unit').then(response => {
|
|
@@ -265,14 +240,22 @@
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ let obj = JSON.parse(JSON.stringify(this.dialogForm))
|
|
|
+ if(obj.chemicalCategory[1]){
|
|
|
+ obj.chemicalCategoryClass = obj.chemicalCategory[1]
|
|
|
+ obj.chemicalCategory = obj.chemicalCategory[0]
|
|
|
+ }else{
|
|
|
+ obj.chemicalCategoryClass = null;
|
|
|
+ obj.chemicalCategory = obj.chemicalCategory[0]
|
|
|
+ }
|
|
|
if(this.dialogForm.chemicalId){
|
|
|
- chemicalChemicalUpdate(this.dialogForm).then(response => {
|
|
|
+ chemicalChemicalUpdate(obj).then(response => {
|
|
|
this.msgSuccess(response.message)
|
|
|
this.$parent.submitSuccessful();
|
|
|
this.addChemicalsOpen(3);
|
|
|
});
|
|
|
}else{
|
|
|
- chemicalChemicalAdd(this.dialogForm).then(response => {
|
|
|
+ chemicalChemicalAdd(obj).then(response => {
|
|
|
this.msgSuccess(response.message)
|
|
|
this.$parent.submitSuccessful();
|
|
|
this.addChemicalsOpen(3);
|
|
@@ -280,6 +263,9 @@
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ addHandleChange(value, selectedData) {
|
|
|
+ this.$refs.addCascader.dropDownVisible = false;
|
|
|
}
|
|
|
},
|
|
|
}
|