Files
laws_weilai/jero-web/src/views/virtualAuthenticationList/components/batSetting.vue
T

275 lines
8.9 KiB
Java

<template>
<a-modal
:title="$t('batSetting')"
:width="900"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
>
<a-form-model class="formAdd" v-model="formInline" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('statisticalNodes')">{{$t('statisticalNodes')}}</span>
</div>
<a-form-model-item class="itemModel-multi">
<a-select :placeholder="$t('PleaseSelect')+$t('statisticalNodes')"
class="box-input"
optionFilterProp="label"
@change="DutyDepartChange"
mode="multiple"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
v-model="formInline.dutyDepart">
<a-select-option v-for="(item, key) in firstLevelDutyTerritoryList"
:key="key"
:label="item.key"
:value="item.key">
<span style="display: inline-block;width: 100%" :title=" item.key ">
{{ item.key }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('areaOfResponsibility')">{{$t('areaOfResponsibility')}}</span>
</div>
<a-form-model-item class="itemModel-multi">
<a-select :placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
class="box-input"
allowClear
optionFilterProp="label"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
v-model="formInline.dutyTerritory">
<a-select-option v-for="(item, key) in dutyTerritoryList"
:key="key"
:label="item.itemText"
:value="item.itemValue">
<span style="display: inline-block;width: 100%" :title=" item.itemText ">
{{ item.itemText }}
</span>
</a-select-option>
</a-select>
<!-- <j-dict-select-tag class="box-input"-->
<!-- v-model="formInline.dutyTerritory"-->
<!-- :placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"-->
<!-- :type="'select'"-->
<!-- :triggerChange="false" :dictCode="'duty_territory'"/>-->
<!-- <j-dict-select-tag class="box-input" v-model="formInline.dutyTerritory"-->
<!-- @input="handleInput('dutyTerritory')"-->
<!-- :placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"-->
<!-- :type="'select'"-->
<!-- :triggerChange="false" dictCode="duty_territory"/>-->
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('typeOfDeliverables')">{{$t('typeOfDeliverables')}}</span>
</div>
<a-form-model-item class="itemModel">
<a-tree-select
tree-node-filter-prop="title"
v-model="formInline.deliverableType"
:maxTagCount="1"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
:tree-data="DeliverableTreeList"
:placeholder="$t('PleaseSelect')+$t('typeOfDeliverables')"
/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
</template>
<script>
import { getAction, postAction } from '../../../api/manage'
export default {
name: 'batSetting',
props: ['url'],
data() {
return {
visible: false,
confirmLoading: false,
formInline: {},
rules: {},
ids: [],
DeliverableTreeList: [],
firstLevelDutyTerritoryList:[],
dutyTerritoryList:[],
}
},
mounted() {
this.getDeliverableTree()
},
methods: {
getFirstLevelDutyTerritory() {
getAction('/sys/dictItem/getFirstLevelDutyTerritory', {}).then((res) => {
if (res.success) {
this.firstLevelDutyTerritoryList = res.result
} else {
this.firstLevelDutyTerritoryList = []
}
})
},
DutyDepartChange(event) {
this.formInline.dutyTerritory = []
this.formInline = { ...this.formInline }
this.getDutyTerritory(event.join(','))
},
getDutyTerritory(row) {
let query = {
dutyDepart: row
}
getAction('/sys/dict/getDutyTeryByDD', query).then((res) => {
if (res.success) {
this.dutyTerritoryList = res.result || []
} else {
this.dutyTerritoryList = []
}
})
},
edit(data) {
this.visible = true
this.getFirstLevelDutyTerritory()
this.dutyTerritoryList = []
this.$nextTick(() => {
this.ids = data || []
this.formInline = {}
})
},
handleOk() {
if (this.formInline.dutyTerritory) {
this.formInline.authDummyInventoryBaseId = this.$route.query.id
this.handleOnTwo()
} else {
this.formInline.authDummyInventoryBaseId = this.$route.query.id
this.handleOkOne()
}
},
handleOkOne() {
let ids = JSON.parse(JSON.stringify(this.ids))
let formInline = JSON.parse(JSON.stringify(this.formInline))
Object.keys(formInline).forEach(res => {
if (formInline[res] instanceof Array) {
formInline[res] = formInline[res].join(',')
}
})
let query = {
ids: ids.join(','),
...formInline
}
this.confirmLoading = true
postAction(this.url.setBatch, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.confirmLoading = false
this.$emit('batSettingList')
} else {
this.$message.warning(res.message)
this.confirmLoading = false
}
})
},
handleOnTwo() {
let _this = this
this.$confirm({
content: _this.$t('areResponsibilityAreaInformationBatch'),
onOk() {
let ids = JSON.parse(JSON.stringify(_this.ids))
let formInline = JSON.parse(JSON.stringify(_this.formInline))
Object.keys(formInline).forEach(res => {
if (formInline[res] instanceof Array) {
formInline[res] = formInline[res].join(',')
}
})
let query = {
ids: ids.join(','),
...formInline
}
_this.confirmLoading = true
postAction(_this.url.setBatch, query).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.visible = false
_this.confirmLoading = false
_this.$emit('batSettingList')
} else {
_this.$message.warning(res.message)
_this.confirmLoading = false
}
})
}
})
},
handleCancel() {
this.formInline = {}
this.visible = false
},
// handleInput(value) {
// this.$nextTick(() => {
// this.formInline = { ...this.formInline }
// this.$refs.ruleForm.validateField([value])
// })
// },
getDeliverableTree() {
getAction('/sys/category/getCertificationDeliverableTree', {}).then((res) => {
if (res.success) {
this.DeliverableTreeList = res.result
} else {
this.DeliverableTreeList = []
}
})
},
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.title-text {
width: 104px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
</style>