123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
-
- <el-dialog
- :title="$t('Edb.Detail.batch_add_edb')"
- :visible.sync="isShow"
- :close-on-click-modal="false"
- :modal-append-to-body="false"
- @close="cancelHandle"
- width="1000px"
- top="5vh"
- v-dialogDrag
- center
- >
- <div class="add-dialog-wrap">
- <el-table :data="tableData" border height="500px">
- <el-table-column
- :label="$t('Edb.Detail.e_id')"
- align="center"
- prop="IndexCode"
- />
- <el-table-column
- :label="$t('Edb.Detail.e_name')"
- align="center"
- width="210px"
- >
- <template slot-scope="scope">
- <div class="name-cell">
- <el-input
- v-model="scope.row.IndexName"
- :placeholder="$t('Edb.InputHolderAll.input_name')"
- style="width: 100%; margin: 5px 0"
- :class="
- existNameArr.includes(scope.row.IndexName) && 'error-ipt'
- "
- />
- <div
- class="error"
- v-if="existNameArr.includes(scope.row.IndexName)"
- >
- <span>{{ $t("BloombergPage.add_edb_check_hint2") }}</span>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- :label="$t('Edb.Detail.e_unit')"
- align="center"
- width="150px"
- >
- <template slot-scope="scope">
- <selectUnit v-model="scope.row.Unit" />
- </template>
- </el-table-column>
- <el-table-column
- :label="$t('Edb.Detail.e_fre')"
- align="center"
- width="120px"
- >
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.Frequency"
- :placeholder="$t('EtaBasePage.select_frequency')"
- >
- <el-option
- v-for="item in $parent.frequencyList"
- :key="item.val"
- :label="item.label"
- :value="item.val"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column align="center" width="320px">
- <template
- slot="header"
- slot-scope="scope"
- style="
- display: flex;
- align-items: center;
- justify-content: space-between;
- "
- >
- <el-radio-group
- v-model="classifyType"
- @change="handleClassifyTypeChange"
- style="flex: 1; margin-right: 20px"
- >
- <el-radio :label="0" style="margin-right: 20px"
- >{{
- $t("EtaBasePage.subdirectory_radio")
- }}</el-radio
- >
- <el-radio :label="1"
- >{{
- $t("EtaBasePage.directory_radio")
- }}</el-radio
- >
- </el-radio-group>
- <el-cascader
- v-if="classifyType == 1"
- v-model="commonClassifyId"
- :options="classifyOpt"
- :props="levelProps"
- :placeholder="$t('Edb.InputHolderAll.input_menu')"
- :disabled="classifyType == 0"
- @change="handleClassifyChange()"
- style="width: 120px"
- />
- </template>
- <template slot-scope="{ row, $index }">
- <el-cascader
- v-model="row.ClassifyId"
- :options="classifyOpt"
- :props="levelProps"
- :placeholder="$t('Edb.InputHolderAll.input_menu')"
- :disabled="classifyType == 1"
- class="cascader-wrapper"
- />
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div style="text-align: center; margin: 30px 0">
- <el-button @click="cancelHandle">{{ $t("Dialog.cancel_btn") }}</el-button>
- <el-button type="primary" @click="handleCheckName" :loading="saveLoading">
- {{ $t("ManualEdbListPage.add_tobase_btn") }}
- </el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import { dataBaseInterface } from "@/api/api.js";
- export default {
- props: {
- isShow: {
- type: Boolean,
- },
- list: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- tableData: [],
- saveLoading: false,
- classifyType: 0,
- classifyOpt: [],
- commonClassifyId: 0,
- levelProps: {
- label: "ClassifyName",
- value: "ClassifyId",
- children: "Children",
- checkStrictly: true,
- emitPath: false,
- },
- existNameArr: [],
- };
- },
- watch: {
- isShow(nval) {
- if (!nval) return;
- this.initDialog();
- this.getClassifyOpt();
- this.tableData = this.list.map((_) => ({
- ..._,
- ClassifyId: 0,
- }));
- },
- },
- methods: {
- initDialog() {
- this.classifyType = 0;
- this.commonClassifyId = 0;
- this.existNameArr = [];
- },
- filterNodes(arr) {
- arr.length &&
- arr.forEach((item) => {
- item.Children.length && this.filterNodes(item.Children);
- if (!item.Children.length) {
- delete item.Children;
- }
- });
- },
-
- async getClassifyOpt() {
- const res = await dataBaseInterface.menuListV3();
- if (res.Ret !== 200) return;
- this.filterNodes(res.Data.AllNodes || []);
- this.classifyOpt = res.Data.AllNodes || [];
- },
- cancelHandle() {
- this.existNameArr = [];
- this.$emit("update:isShow", false);
- },
-
- handleClassifyChange() {
- if (this.classifyType === 1) {
- this.tableData.forEach((item) => {
- item.ClassifyId = this.commonClassifyId;
- });
- }
- },
- handleClassifyTypeChange() {
- if (this.classifyType == 0) {
- this.commonClassifyId = 0;
- }
- },
- handleCheckName() {
-
- this.existNameArr = [];
- this.$emit("handleCheckName", this.tableData);
- },
- setValue(key, value) {
-
- this[key] = value;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .add-dialog-wrap {
- .name-cell {
- position: relative;
- .error {
- position: absolute;
- bottom: -16px;
- color: #f00;
- }
- }
- }
- </style>
- <style lang="scss">
- .add-dialog-wrap {
- .error-ipt .el-input__inner {
- border-color: #f00;
- }
- .el-cascader .el-input {
- width: 100%;
- }
- .el-table .cell {
- overflow: visible;
- }
- }
- </style>
|