Browse Source

2024-1-5 项目物料调整,字典下拉框,是否使用默认值

master
zelian_wu 2 years ago
parent
commit
7269e749a4
  1. 1
      src/api/dict.js
  2. 2
      src/views/modules/customer/customerInformationManagement.vue
  3. 332
      src/views/modules/project/projectInfo/com_project_info_part.vue
  4. 11
      src/views/modules/project/projectInfo/projectInfo.vue
  5. 4
      src/views/modules/quotation/sellForQuotation.vue
  6. 12
      src/views/modules/sys/dict-data-select.vue
  7. 79
      src/views/modules/sys/dict-data.vue
  8. 50
      src/views/modules/sys/dict.vue

1
src/api/dict.js

@ -55,6 +55,7 @@ export const saveDictData = (data) => createAPI(`/sys/dictData/save`,'post',data
* @returns {*} * @returns {*}
*/ */
export const removeDictData = (data) => createAPI(`/sys/dictData/remove`,'post',data); export const removeDictData = (data) => createAPI(`/sys/dictData/remove`,'post',data);
export const removeBatchDictData = (data) => createAPI(`/sys/dictData/removeBatch`,'post',data);
/** /**
* 删除字典数据 * 删除字典数据
* @param data * @param data

2
src/views/modules/customer/customerInformationManagement.vue

@ -520,7 +520,7 @@
<el-table-column <el-table-column
header-align="center" header-align="center"
align="center" prop="projectId" align="center" prop="projectId"
width="130" label="项目号">
width="160" label="项目号">
<template slot-scope="{row,$index}"> <template slot-scope="{row,$index}">
<el-link style="cursor: pointer" @click="clickProjectId(row.projectId)">{{row.projectId}}</el-link> <el-link style="cursor: pointer" @click="clickProjectId(row.projectId)">{{row.projectId}}</el-link>
</template> </template>

332
src/views/modules/project/projectInfo/com_project_info_part.vue

@ -55,51 +55,150 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog <el-dialog
width="600px"
:title="!dataForm.id ? '添加' :'编辑'"
width="50%"
:title="!dataForm.id ? '新增' :'编辑'"
:close-on-click-modal="false" :close-on-click-modal="false"
@close="closeDataFromDialog"
:visible.sync="visible"> :visible.sync="visible">
<el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
<el-form-item :label="'项目料号'">
<el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input>
</el-form-item>
<!-- <el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">-->
<!-- <el-form-item :label="'项目料号'">-->
<!-- <el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item prop="partTypeDesc" :rules="dataRole.partTypeDesc">-->
<!-- <span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料分类</a></span>-->
<!-- <el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)" ></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label=" ">-->
<!-- <span slot="label" style="" @click="getBaseList(19,1)"><a herf="#">属性模板</a></span>-->
<!-- <el-input v-model="dataForm.codeNo" style="width: 130px" readonly @focus="getBaseList(19,1)"></el-input>-->
<!-- </el-form-item>-->
<el-form-item prop="partTypeDesc" :rules="dataRole.partTypeDesc">
<span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料类别</a></span>
<el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)" ></el-input>
<!-- <el-form-item :label="'属性模板名称'">-->
<!-- <el-input v-model="dataForm.codeDesc" style="width: 130px" disabled></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-form :inline="true" label-position="top" label-width="100px" >-->
<!-- <el-form-item :label="'物料描述'" prop="partDesc" :rules="dataRole.partDesc">-->
<!-- <el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-form :inline="true" label-position="top" label-width="100px">-->
<!--&lt;!&ndash; <el-form-item :label="'物料名称'" prop="partName" :rules="dataRole.partName">&ndash;&gt;-->
<!-- <el-form-item :label="'物料名称'" prop="partName">-->
<!-- <el-input v-model="dataForm.partName" style="width: 562px" ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-form :inline="true" label-position="top" label-width="100px" >-->
<!-- <el-form-item :label="'规格型号'">-->
<!-- <el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-form :inline="true" label-position="top" label-width="100px" >-->
<!-- <el-form-item :label="'物料图号'">-->
<!-- <el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <el-form :inline="true" label-position="top" label-width="100px" >-->
<!-- <el-form-item :label="'备注'">-->
<!-- <el-input v-model="dataForm.remark" style="width: 562px" ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<el-form label-position="top" ref="dataFrom" :model="dataForm" :rules="dataRole">
<el-row :gutter="15">
<el-col :span="4">
<el-form-item label="项目料号" prop="testPartNo">
<el-input v-model="dataForm.testPartNo" disabled clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label=" ">
<span slot="label" style="" @click="getBaseList(19,1)"><a herf="#">属性模板</a></span>
<el-input v-model="dataForm.codeNo" style="width: 130px" readonly @focus="getBaseList(19,1)"></el-input>
</el-col>
<el-col :span="8">
<el-form-item label="物料描述" prop="partDesc" :rules="dataRole.partDesc">
<el-input v-model="dataForm.partDesc" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="'属性模板名称'">
<el-input v-model="dataForm.codeDesc" style="width: 130px" disabled></el-input>
</el-col>
<el-col :span="12">
<el-form-item label="属性模板">
<span slot="label" style="" @click="getBaseList(20)"><a herf="#">属性模板</a></span>
<el-row :gutter="3">
<el-col :span="8">
<el-input v-model="dataForm.codeNo" readonly @focus="getBaseList(20)"></el-input>
</el-col>
<el-col :span="16">
<el-input v-model="dataForm.codeDesc" disabled></el-input>
</el-col>
</el-row>
</el-form-item> </el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
<el-form-item :label="'物料名称'" prop="partName" :rules="dataRole.partName">
<el-input v-model="dataForm.partName" style="width: 562px" ></el-input>
</el-col>
<el-col :span="8">
<el-form-item label="物料名称">
<el-input v-model="dataForm.partName"></el-input>
</el-form-item> </el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'物料描述'">
<el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input>
</el-col>
<el-col :span="8">
<el-form-item label="物料图号">
<el-input v-model="dataForm.materialNumber"></el-input>
</el-form-item> </el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'规格型号'">
<el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input>
</el-col>
<el-col :span="8">
<el-form-item label="规格型号">
<el-input v-model="dataForm.partSpec" clearable></el-input>
</el-form-item> </el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'物料图号'">
<el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input>
</el-col>
<el-col :span="12">
<el-form-item prop="partType" label="物料分类">
<span slot="label" @click="getBaseList(108)"><a herf="#">物料分类</a></span>
<el-row :gutter="3">
<el-col :span="8">
<el-input v-model="dataForm.partType" readonly @focus="getBaseList(108)"></el-input>
</el-col>
<el-col :span="16">
<el-input v-model="dataForm.partTypeDesc" disabled></el-input>
</el-col>
</el-row>
</el-form-item> </el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'备注'">
<el-input v-model="dataForm.remark" style="width: 562px" ></el-input>
</el-col>
<el-col :span="12">
<el-form-item prop="groupId">
<span slot="label" @click="getBaseList(109)"><a herf="#">物料分组</a></span>
<el-row :gutter="3">
<el-col :span="8">
<el-input v-model="dataForm.groupId" readonly @focus="getBaseList(109)"></el-input>
</el-col>
<el-col :span="16">
<el-input v-model="dataForm.groupName" disabled></el-input>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<span slot="label" @click="getBaseList(110)"><a herf="#">商品组1</a></span>
<el-row :gutter="3">
<el-col :span="8">
<el-input v-model="dataForm.productGroupId1" readonly @focus="getBaseList(110)"></el-input>
</el-col>
<el-col :span="16">
<el-input v-model="dataForm.productGroupName1" disabled></el-input>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<span slot="label" @click="getBaseList(111)"><a herf="#">商品组2</a></span>
<el-row :gutter="3">
<el-col :span="8">
<el-input v-model="dataForm.productGroupId2" readonly @focus="getBaseList(111)"></el-input>
</el-col>
<el-col :span="16">
<el-input v-model="dataForm.productGroupName2" disabled></el-input>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" style="height: 90px">
<el-input type="textarea" resize="none" style="min-width: 90px" :autosize="{minRows: 3, maxRows: 3}" v-model="dataForm.remark"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -204,8 +303,10 @@
refreshItemModal, refreshItemModal,
} from "@/api/base/properties.js" } from "@/api/base/properties.js"
import Chooselist from '@/views/modules/common/Chooselist' import Chooselist from '@/views/modules/common/Chooselist'
import DictDataSelect from "../../sys/dict-data-select.vue";
export default { export default {
components: { components: {
DictDataSelect,
Chooselist Chooselist
}, },
data() { data() {
@ -291,13 +392,13 @@
},{ },{
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
functionId: 101002001, functionId: 101002001,
serialNumber: '101002001Table4PartName',
serialNumber: '101002001Table4PartDesc',
tableId: "101002001Table4", tableId: "101002001Table4",
tableName: "项目物料", tableName: "项目物料",
columnProp: "partName",
columnProp: "partDesc",
headerAlign: "center", headerAlign: "center",
align: "left", align: "left",
columnLabel: "物料名称",
columnLabel: "物料描述",
columnHidden: false, columnHidden: false,
columnImage: false, columnImage: false,
columnSortable: false, columnSortable: false,
@ -308,13 +409,13 @@
},{ },{
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
functionId: 101002001, functionId: 101002001,
serialNumber: '101002001Table4PartDesc',
serialNumber: '101002001Table4PartName',
tableId: "101002001Table4", tableId: "101002001Table4",
tableName: "项目物料", tableName: "项目物料",
columnProp: "partDesc",
columnProp: "partName",
headerAlign: "center", headerAlign: "center",
align: "left", align: "left",
columnLabel: "物料描述",
columnLabel: "物料名称",
columnHidden: false, columnHidden: false,
columnImage: false, columnImage: false,
columnSortable: false, columnSortable: false,
@ -492,9 +593,22 @@
username:'', username:'',
codeNo:'', codeNo:'',
codeDesc:'', codeDesc:'',
groupId:undefined,
groupName:undefined,
productGroupId1:undefined,
productGroupName1:undefined,
productGroupId2:undefined,
productGroupName2:undefined,
}, },
dataRole: { dataRole: {
partTypeDesc: [
partType: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
groupId: [
{ {
required: true, required: true,
message: ' ', message: ' ',
@ -507,6 +621,12 @@
message: ' ', message: ' ',
trigger: 'change' trigger: 'change'
} }
],partDesc: [
{
required: true,
message: ' ',
trigger: 'change'
}
], ],
}, },
// start // start
@ -644,11 +764,20 @@
if(type==1) { if(type==1) {
strVal = this.dataForm.partType strVal = this.dataForm.partType
} }
}
if (val === 19) {
}else if (val === 19) {
if(type==1) { if(type==1) {
strVal = this.dataForm.codeNo strVal = this.dataForm.codeNo
} }
}else if (val === 108) {
strVal = this.dataForm.partType
} else if (val === 109) {
strVal = this.dataForm.groupId
} else if (val === 110) {
strVal = this.dataForm.productGroupId1
} else if (val === 111) {
strVal = this.dataForm.productGroupId2
}else if (val === 20) {
strVal = this.dataForm.codeNo
} }
this.$refs.baseList.init(val, strVal) this.$refs.baseList.init(val, strVal)
}) })
@ -660,12 +789,26 @@
this.dataForm.partType = val.Base_id this.dataForm.partType = val.Base_id
this.dataForm.partTypeDesc = val.Base_desc this.dataForm.partTypeDesc = val.Base_desc
} }
}
if (this.tagNo === 19) {
}else if (this.tagNo === 19) {
if(this.tagNo1==1) { if(this.tagNo1==1) {
this.dataForm.codeNo = val.Code_no this.dataForm.codeNo = val.Code_no
this.dataForm.codeDesc = val.Code_desc this.dataForm.codeDesc = val.Code_desc
} }
} else if (this.tagNo === 108) {
this.dataForm.partType = val.family_id
this.dataForm.partTypeDesc = val.family_name
} else if (this.tagNo === 109) {
this.dataForm.groupId = val.group_id
this.dataForm.groupName = val.group_name
} else if (this.tagNo === 110) {
this.dataForm.productGroupId1 = val.product_group_id
this.dataForm.productGroupName1 = val.product_group_name
} else if (this.tagNo === 111) {
this.dataForm.productGroupId2 = val.product_group_id
this.dataForm.productGroupName2 = val.product_group_name
} else if (this.tagNo === 20) {
this.dataForm.codeNo = val.Code_no
this.dataForm.codeDesc = val.Code_desc
} }
}, },
// //
@ -693,63 +836,49 @@
}) })
return false; return false;
} }
this.dataForm={
id:0,
site: this.searchData.site,
projectId: this.searchData.projectId,
testPartNo:'',
partType:'',
partTypeDesc:'',
partName:'',
partDesc:'',
partSpec:'',
remark:'',
materialNumber:'',
username:this.$store.state.user.name,
codeNo:'',
codeDesc:'',
}
this.visible=true; this.visible=true;
}, },
updateModel(row){ updateModel(row){
this.dataForm={
id:row.id,
site: row.site,
projectId: row.projectId,
testPartNo:row.testPartNo,
partType:row.partType,
partTypeDesc:row.partTypeDesc,
partName:row.partName,
partDesc:row.partDesc,
partSpec:row.partSpec,
remark:row.remark,
materialNumber:row.materialNumber,
codeNo:row.codeNo,
codeDesc:row.codeDesc,
username:this.$store.state.user.name,
}
this.dataForm = {...row}
this.visible=true; this.visible=true;
}, },
saveData(){ saveData(){
if(this.dataForm.partType==''||this.dataForm.partType==null){
this.$alert('请选择物料类别!', '错误', {
this.$refs.dataFrom.validate((vaildate)=>{
if (vaildate){
saveProjectPart(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.visible = false
this.searchTable();
} else {
this.$message.error(data.msg)
}
})
}else {
// if(this.dataForm.partName==''||this.dataForm.partName==null){
// this.$alert('', '', {
// confirmButtonText: ''
// })
// return false;
// }
if (!this.dataForm.partType){
this.$alert('请选择物料分类!', '错误', {
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
return false; return false;
} }
if(this.dataForm.partName==''||this.dataForm.partName==null){
this.$alert('请输入物料名称!', '错误', {
if (!this.dataForm.groupId){
this.$alert('请选择物料分组!', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(!this.dataForm.partDesc){
this.$alert('请输入物料描述!', '错误', {
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
return false; return false;
} }
saveProjectPart(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.visible = false
this.searchTable();
} else {
this.$message.error(data.msg)
} }
}) })
}, },
@ -905,6 +1034,31 @@
return s return s
}, },
closeDataFromDialog(){
this.dataForm={
id:0,
site: this.searchData.site,
projectId: this.searchData.projectId,
testPartNo:'',
partType:'',
partTypeDesc:'',
partName:'',
partDesc:'',
partSpec:'',
remark:'',
materialNumber:'',
username:this.$store.state.user.name,
codeNo:'',
codeDesc:'',
groupId:undefined,
groupName:undefined,
productGroupId1:undefined,
productGroupName1:undefined,
productGroupId2:undefined,
productGroupName2:undefined,
}
this.$refs.dataFrom.resetFields();
},
}, },
} }
</script> </script>

11
src/views/modules/project/projectInfo/projectInfo.vue

@ -2,11 +2,12 @@
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;"> <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
<el-form-item :label="'项目编号'"> <el-form-item :label="'项目编号'">
<el-input v-model="searchData.projectId" style="width: 130px"></el-input>
<el-input v-model="searchData.projectId" style="width: 160px"></el-input>
</el-form-item> </el-form-item>
<el-form-item >
<span slot="label" style="" @click="getBaseList(1010,1)"><a herf="#">项目类型</a></span>
<el-input v-model="searchData.projectType" style="width: 120px"></el-input>
<el-form-item label="项目类型">
<!-- <span slot="label" style="" @click="getBaseList(1010,1)"><a herf="#">项目类型</a></span>-->
<!-- <el-input v-model="searchData.projectType" style="width: 120px"></el-input>-->
<dict-data-select dict-type="project_info_type_db" filterable clearable :use-default-value="false" v-model="searchData.projectType"></dict-data-select>
</el-form-item> </el-form-item>
<el-form-item :label="'项目责任人'"> <el-form-item :label="'项目责任人'">
<el-input v-model="searchData.projectOwnerName" style="width: 130px"></el-input> <el-input v-model="searchData.projectOwnerName" style="width: 130px"></el-input>
@ -371,9 +372,11 @@
import purchase from "./com_project_info_purchase_request";/*組件*/ import purchase from "./com_project_info_purchase_request";/*組件*/
import technicalSpecification from "./com_project_technicalSpecification"; import technicalSpecification from "./com_project_technicalSpecification";
import quotationHeader from "./com_project_info_quotation.vue"; import quotationHeader from "./com_project_info_quotation.vue";
import DictDataSelect from "../../sys/dict-data-select.vue";
/*組件*/ /*組件*/
export default { export default {
components: { components: {
DictDataSelect,
Chooselist, Chooselist,
AddOrUpdate, AddOrUpdate,
projectUploadFile, projectUploadFile,

4
src/views/modules/quotation/sellForQuotation.vue

@ -314,10 +314,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-footer style="height:30px;margin-top: 20px;text-align:center">
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="insertQuotationHeaderBtn" @click="saveQuotationHeader">确定</el-button> <el-button type="primary" :loading="insertQuotationHeaderBtn" @click="saveQuotationHeader">确定</el-button>
<el-button @click="insertDiaLogFlag = false">关闭</el-button> <el-button @click="insertDiaLogFlag = false">关闭</el-button>
</el-footer>
</span>
</el-dialog> </el-dialog>
<!--询价单号选择弹框--> <!--询价单号选择弹框-->

12
src/views/modules/sys/dict-data-select.vue

@ -20,6 +20,10 @@ export default {
}, },
value:{ value:{
required: true, required: true,
},
useDefaultValue:{
type:Boolean,
default:true,
} }
}, },
data () { data () {
@ -35,7 +39,7 @@ export default {
// value ,value // value ,value
if (!this.value && this.options.length > 0){ if (!this.value && this.options.length > 0){
let find = this.options.find(item=>item.isDefault === 'Y'); let find = this.options.find(item=>item.isDefault === 'Y');
if (find){
if (find && find.status === 'Y'){
this.$emit("change",find.dictValue); this.$emit("change",find.dictValue);
} }
} }
@ -47,13 +51,19 @@ export default {
site:this.$store.state.user.site, site:this.$store.state.user.site,
dictType:this.dictType dictType:this.dictType
} }
try {
// //
let {data} = await selectDictDataList(params); let {data} = await selectDictDataList(params);
// //
if (data && data.code === 0){ if (data && data.code === 0){
this.options = data.rows; this.options = data.rows;
} }
if (this.useDefaultValue){
this.dictDefaultValue(); this.dictDefaultValue();
}
}catch (e) {
return Promise.reject(e)
}
}, },
// el-select @change, // el-select @change,
changeDictData(val){ changeDictData(val){

79
src/views/modules/sys/dict-data.vue

@ -1,7 +1,9 @@
<script> <script>
import {updateDictData,selectDictTypeList,saveDictData,selectDictDataPage,delDictData,delBatchDictData} from "../../../api/dict";
import {updateDictData,selectDictTypeList,saveDictData,selectDictDataPage,delDictData,delBatchDictData,removeBatchDictData} from "../../../api/dict";
import DictDataSelect from "./dict-data-select.vue";
export default { export default {
name: "dictData", name: "dictData",
components: {DictDataSelect},
data(){ data(){
return{ return{
// //
@ -62,6 +64,7 @@ export default {
}, },
methods:{ methods:{
initDictData(){ initDictData(){
this.dictDataList = []
selectDictDataPage(this.no,this.size,this.searchData).then(({data})=>{ selectDictDataPage(this.no,this.size,this.searchData).then(({data})=>{
if (data && data.code === 0){ if (data && data.code === 0){
this.dictDataList = data.rows; this.dictDataList = data.rows;
@ -83,8 +86,21 @@ export default {
}, },
closeSaveDataDialog(){ closeSaveDataDialog(){
this.$refs.saveDataForm.resetFields(); this.$refs.saveDataForm.resetFields();
this.saveData.remark = undefined;
this.saveData.isDefault = 'N';
this.saveData = {
dictId:undefined,
dictLabel:undefined,
dictType: undefined,
dictValue: undefined,
dictSort: 1,
isDefault: 'N',
status:'Y',
createBy:this.$store.state.user.name,
createDate:undefined,
updateBy:this.$store.state.user.name,
updateDate:undefined,
remark:undefined,
site:this.$store.state.user.site,
}
}, },
openSaveDataDialog(){ openSaveDataDialog(){
this.saveData.dictType = this.searchData.dictType; this.saveData.dictType = this.searchData.dictType;
@ -177,6 +193,24 @@ export default {
}); });
}, },
removeBatchDictData(){
let some = this.selectionDictDataList.some(item=>item.isSystem === 'N');
if (!some){
this.$alert('系统参数,无法停用', '警告', {confirmButtonText: '确定',});
return;
}
removeBatchDictData(this.selectionDictDataList).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg);
this.initDictData();
this.$refs.dictDataTable.clearSelection();
}else {
this.$message.error(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleSelectionChange(val){ handleSelectionChange(val){
this.selectionDictDataList = val; this.selectionDictDataList = val;
}, },
@ -254,18 +288,19 @@ export default {
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-form-item label="状态"> <el-form-item label="状态">
<el-select v-model="searchData.status" clearable style="width: 100%" placeholder="请选择">
<el-option
key="Y"
label="启用"
value="Y">
</el-option>
<el-option
key="N"
label="停用"
value="N">
</el-option>
</el-select>
<!-- <el-select v-model="searchData.status" clearable style="width: 100%" placeholder="请选择">-->
<!-- <el-option-->
<!-- key="Y"-->
<!-- label="启用"-->
<!-- value="Y">-->
<!-- </el-option>-->
<!-- <el-option-->
<!-- key="N"-->
<!-- label="停用"-->
<!-- value="N">-->
<!-- </el-option>-->
<!-- </el-select>-->
<dict-data-select v-model="searchData.status" clearable dict-type="sys_status" :use-default-value="false"></dict-data-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
@ -277,7 +312,8 @@ export default {
</el-form> </el-form>
<div style="margin-bottom: 8px;margin-top: 8px"> <div style="margin-bottom: 8px;margin-top: 8px">
<el-button type="primary" icon="el-icon-plus" @click="openDictTypeDialog(0)"> </el-button> <el-button type="primary" icon="el-icon-plus" @click="openDictTypeDialog(0)"> </el-button>
<el-button type="primary" icon="el-icon-delete" @click="delBatchDictData"> </el-button>
<el-button type="primary" icon="el-icon-delete" v-if="false" @click="delBatchDictData"> </el-button>
<el-button type="primary" @click="removeBatchDictData"> </el-button>
</div> </div>
<el-table <el-table
border height="75vh" row-key="dictCode" border height="75vh" row-key="dictCode"
@ -290,9 +326,14 @@ export default {
<el-table-column prop="dictLabel" header-align="center" align="center" label="字典标签"/> <el-table-column prop="dictLabel" header-align="center" align="center" label="字典标签"/>
<el-table-column prop="dictValue" header-align="center" label="字典键值"/> <el-table-column prop="dictValue" header-align="center" label="字典键值"/>
<el-table-column prop="dictSort" header-align="center" label="字典排序"/> <el-table-column prop="dictSort" header-align="center" label="字典排序"/>
<el-table-column prop="status" header-align="center" align="center" label="字典状态">
<el-table-column prop="status" header-align="center" width="80" align="center" label="字典状态">
<template slot-scope="{row,$index}">
<span :style="{color:row.status === 'Y'?'#67C23A':'red'}">{{row.status === 'Y'?'启用':'停用'}}</span>
</template>
</el-table-column>
<el-table-column prop="isDefault" header-align="center" width="80" align="center" label="是否默认">
<template slot-scope="{row,$index}"> <template slot-scope="{row,$index}">
<span>{{row.status === 'Y'?'启用':'停用'}}</span>
<span>{{row.isDefault === 'Y'?'是':'否'}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" header-align="center" align="left" label="备注"/> <el-table-column prop="remark" header-align="center" align="left" label="备注"/>
@ -301,7 +342,7 @@ export default {
<el-table-column header-align="center" align="center" label="操作" width="160"> <el-table-column header-align="center" align="center" label="操作" width="160">
<template slot-scope="{row,$index}"> <template slot-scope="{row,$index}">
<el-button type="text" :disabled="row.isSystem === 'Y'" @click="openDictTypeDialog(1,row)" icon="el-icon-edit">修改</el-button> <el-button type="text" :disabled="row.isSystem === 'Y'" @click="openDictTypeDialog(1,row)" icon="el-icon-edit">修改</el-button>
<el-button type="text" :disabled="row.isSystem === 'Y'" @click="delDictData(row)" icon="el-icon-delete">删除</el-button>
<el-button type="text" :disabled="row.isSystem === 'Y'" v-if="false" @click="delDictData(row)" icon="el-icon-delete">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

50
src/views/modules/sys/dict.vue

@ -1,9 +1,10 @@
<script> <script>
import {saveDictType,selectDictTypePage,delDictType,delBatchDictType,updateDictType} from "../../../api/dict"; import {saveDictType,selectDictTypePage,delDictType,delBatchDictType,updateDictType} from "../../../api/dict";
import DictData from "./dict-data.vue"; import DictData from "./dict-data.vue";
import DictDataSelect from "./dict-data-select.vue";
export default { export default {
name: "dict", name: "dict",
components: {DictData},
components: {DictDataSelect, DictData},
data(){ data(){
return{ return{
// //
@ -79,7 +80,18 @@ export default {
}, },
closeSaveDataDialog(){ closeSaveDataDialog(){
this.$refs.saveDataForm.resetFields(); this.$refs.saveDataForm.resetFields();
this.saveData.remark = undefined;
this.saveData={
dictId:undefined,
dictName:undefined,
dictType: undefined,
status:'Y',
createBy:this.$store.state.user.name,
createDate:undefined,
updateBy:this.$store.state.user.name,
updateDate:undefined,
remark:undefined,
site:this.$store.state.user.site,
}
}, },
saveOrUpdate(){ saveOrUpdate(){
this.$refs.saveDataForm.validate((validate,objects)=>{ this.$refs.saveDataForm.validate((validate,objects)=>{
@ -137,10 +149,7 @@ export default {
this.$message.error(error) this.$message.error(error)
}) })
}).catch(() => { }).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
}); });
}, },
delBatchDictType(){ delBatchDictType(){
@ -217,18 +226,19 @@ export default {
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-form-item label="状态"> <el-form-item label="状态">
<el-select v-model="searchData.status" clearable style="width: 100%" placeholder="请选择">
<el-option
key="Y"
label="启用"
value="Y">
</el-option>
<el-option
key="N"
label="停用"
value="N">
</el-option>
</el-select>
<!-- <el-select v-model="searchData.status" clearable style="width: 100%" placeholder="请选择">-->
<!-- <el-option-->
<!-- key="Y"-->
<!-- label="启用"-->
<!-- value="Y">-->
<!-- </el-option>-->
<!-- <el-option-->
<!-- key="N"-->
<!-- label="停用"-->
<!-- value="N">-->
<!-- </el-option>-->
<!-- </el-select>-->
<dict-data-select v-model="searchData.status" clearable dict-type="sys_status" :use-default-value="false"></dict-data-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
@ -256,9 +266,9 @@ export default {
<el-link style="cursor: pointer" @click="clickDictType(row.dictType)">{{row.dictType}}</el-link> <el-link style="cursor: pointer" @click="clickDictType(row.dictType)">{{row.dictType}}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="字典状态">
<el-table-column prop="status" header-align="center" width="80" align="center" label="字典状态">
<template slot-scope="{row,$index}"> <template slot-scope="{row,$index}">
<span>{{row.status === 'Y'?'启用':'停用'}}</span>
<span :style="{color:row.status === 'Y'?'#67C23A':'red'}">{{row.status === 'Y'?'启用':'停用'}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" header-align="center" align="left" label="备注"/> <el-table-column prop="remark" header-align="center" align="left" label="备注"/>

Loading…
Cancel
Save