Quellcode durchsuchen

广告客户管理

devilhell vor 2 Jahren
Ursprung
Commit
dc4db0d8b8

+ 42 - 6
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/api/adSomeelse.js

@@ -2,7 +2,7 @@
  * @Author: wangj
  * @Date: 2023-02-27 20:58:17
  * @LastEditors: @EXtreeDesigner
- * @LastEditTime: 2023-03-03 23:25:18
+ * @LastEditTime: 2023-03-04 15:21:19
  * @FilePath: \imcs-ui\src\api\adSomeelse.js
  * @Description: 异常中心-设备异常、广告管理、优惠券管理
  */
@@ -18,14 +18,23 @@ const apiList = {
     url: `/authority/equ-status`,
     method: 'DELETE'
   },
-  mark: {
-    url: `/msgs/msgsCenterInfo/mark`,
-    method: 'GET'
+  // 广告客户管理
+  adc: {
+    url: `/authority/advertisementCustomer/page`,
+    method: 'POST'
   },
-  save: {
-    url: `/msgs/msgsCenterInfo`,
+  adcadd: {
+    url: `/authority/advertisementCustomer`,
     method: 'POST'
   },
+  adcedit:{
+    url: `/authority/advertisementCustomer`,
+    method: 'PUT'
+  },
+  adcdelete: {
+    url: `/authority/advertisementCustomer`,
+    method: 'DELETE'
+  },
   preview: {
     method: 'POST',
     url: `/msgs/msgsCenterInfo/preview`
@@ -55,3 +64,30 @@ export const bug = {
       })
     }
 }
+
+export const adc = {
+  page (data) {
+    return axiosApi({
+      ...apiList.adc,
+      data,
+    })
+  },
+  save (data) {
+    return axiosApi({
+      ...apiList.adcadd,
+      data,
+    })
+  },
+  update (data) {
+    return axiosApi({
+      ...apiList.adcedit,
+      data,
+    })
+  },
+  delete (data) {
+    return axiosApi({
+      ...apiList.adcdelete,
+      data
+    })
+  }
+}

+ 22 - 3
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/lang/zh/adsel.js

@@ -1,9 +1,9 @@
 /*
  * @Author: wangj
  * @Date: 2023-03-02 17:41:19
- * @LastEditors: wangj
- * @LastEditTime: 2023-03-02 18:28:30
- * @FilePath: \code\src\lang\zh\adsel.js
+ * @LastEditors: @EXtreeDesigner
+ * @LastEditTime: 2023-03-04 14:26:48
+ * @FilePath: \imcs-ui\src\lang\zh\adsel.js
  * @Description: ad and somthing else:广告、异常、优惠券
  */
 export default {
@@ -25,5 +25,24 @@ export default {
       '状态',
       '操作',
     ]
+  },
+  _ad:{
+    // 广告客户管理
+    status:'状态'
+    ,statusList:['全部','启用','冻结']
+    ,contacts:'联系人'
+    ,table:[
+      '客户名称',
+      '联系人'
+      ,'联系手机'
+      ,'备注'
+    ]
+    ,add:[
+      '客户名称'
+      ,'联系人'
+      ,'联系手机'
+      ,'备注'
+      ,'状态'
+    ]
   }
 }

+ 452 - 0
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/ad/client/Index.vue

@@ -0,0 +1,452 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container">
+      <span>
+        <span> {{ $t("_ad.table.0") }}: </span>
+        <span>
+          <el-input
+            class="search-item"
+            v-model="queryParams.model.customerName"
+            :placeholder="$t('_ad.table.0')"
+          />
+        </span>
+
+        <span> {{ $t("_ad.status") }}: </span>
+        <span>
+          <el-select
+            v-model="queryParams.model.customerStatus"
+            :placeholder="$t('_ad.status')"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.name"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </span>
+      </span>
+      <!--操作按钮-->
+      <span>
+        <el-button @click="search" plain type="primary">
+          {{ $t("table.search") }}
+        </el-button>
+        <el-button @click="reset" plain type="warning">
+          {{ $t("table.reset") }}
+        </el-button>
+      </span>
+    </div>
+
+    <!--    添加修改删除-->
+    <el-row class="filter-container">
+      <el-col>
+        <!--添加按钮,调用add方法-->
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="medium"
+          @click="add"
+          >{{ $t("common.add") }}</el-button
+        >
+      </el-col>
+    </el-row>
+
+    <el-table
+      :data="tableData.records"
+      :key="tableKey"
+      @cell-click="cellClick"
+      @filter-change="filterChange"
+      @selection-change="onSelectChange"
+      @sort-change="sortChange"
+      border
+      fit
+      row-key="id"
+      ref="table"
+      style="width: 100%"
+      v-loading="loading"
+    >
+      <el-table-column
+        align="center"
+        type="index"
+        width="40px"
+        :reserve-selection="true"
+      />
+      <!-- 客户名称 -->
+      <el-table-column
+        :label="$t('_ad.table.0')"
+        :show-overflow-tooltip="true"
+        align="center"
+        prop="customerName"
+        width=""
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.customerName }}</span>
+        </template>
+      </el-table-column>
+      <!-- 联系人 -->
+      <el-table-column
+        :label="$t('_ad.table.1')"
+        :show-overflow-tooltip="true"
+        align="center"
+        prop="contactName"
+        width=""
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.contactName }}</span>
+        </template>
+      </el-table-column>
+      <!-- 联系手机 -->
+      <el-table-column
+        :label="$t('_ad.table.2')"
+        :show-overflow-tooltip="true"
+        align="center"
+        prop="contactPhone"
+        width=""
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.contactPhone }}</span>
+        </template>
+      </el-table-column>
+      <!-- 备注 -->
+      <el-table-column
+        :label="$t('_ad.table.3')"
+        :show-overflow-tooltip="true"
+        align="center"
+        prop="customerRemark"
+        width=""
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.customerRemark}}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        :label="$t('table.operation')"
+        align="center"
+        column-key="operation"
+        class-name="small-padding fixed-width"
+        width="100px"
+      >
+        <template slot-scope="{ row }">
+          <i
+            @click="edit(row)"
+            class="el-icon-edit table-operation"
+            :title="$t('common.edit')"
+            style="color: #2db7f5"
+          />
+          <i
+            @click="singleDelete(row)"
+            class="el-icon-delete table-operation"
+            :title="$t('common.delete')"
+            style="color: #f50"
+          />
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination
+      :limit.sync="queryParams.size"
+      :page.sync="queryParams.current"
+      :total="Number(tableData.total)"
+      @pagination="fetch"
+      v-show="tableData.total > 0"
+    />
+    <place-edit
+      :dialog-visible="dialog.isVisible"
+      :type="dialog.type"
+      @close="editClose"
+      @success="editSuccess"
+      ref="edit"
+    />
+    <place-import
+      ref="import"
+      :dialog-visible="fileImport.isVisible"
+      :type="fileImport.type"
+      :action="fileImport.action"
+      accept=".xls,.xlsx"
+      @close="importClose"
+      @success="importSuccess"
+    />
+    <el-dialog
+      :close-on-click-modal="false"
+      :close-on-press-escape="true"
+      title="预览"
+      width="80%"
+      top="50px"
+      :visible.sync="preview.isVisible"
+      v-el-drag-dialog
+    >
+      <el-scrollbar>
+        <div v-html="preview.context"></div>
+      </el-scrollbar>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import Pagination from "@/components/Pagination";
+import elDragDialog from "@/directive/el-drag-dialog";
+import PlaceEdit from "./components/Edit";
+import placeApi from "@/api/Place.js";
+import { adc } from "@/api/adSomeelse";
+import PlaceImport from "@/components/zuihou/Import";
+import {
+  downloadFile,
+  loadEnums,
+  initDicts,
+  initQueryParams,
+} from "@/utils/commons";
+import { CodeToText, TextToCode } from "element-china-area-data";
+
+export default {
+  name: "PlaceManage",
+  directives: { elDragDialog },
+  components: { Pagination, PlaceEdit, PlaceImport },
+  filters: {
+    getCodeName(code) {
+      return CodeToText[code];
+    },
+  },
+  data() {
+    return {
+      selectedOptions: [],
+      options: [
+        {
+          value: "",
+          name: this.$t("_ad.statusList.0"),
+        },
+        {
+          value: "1",
+          name: this.$t("_ad.statusList.1"),
+        },
+        {
+          value: "0",
+          name: this.$t("_ad.statusList.2"),
+        },
+      ],
+      form: {
+        provinces: "",
+        pCode: "",
+        city: "",
+        cCode: "",
+        area: "",
+        aCode: "",
+      },
+
+      // 编辑
+      dialog: {
+        isVisible: false,
+        type: "add",
+      },
+      // 预览
+      preview: {
+        isVisible: false,
+        context: "",
+      },
+      // 导入
+      fileImport: {
+        isVisible: false,
+        type: "import",
+        action: `${process.env.VUE_APP_BASE_API}/place/place/import`,
+      },
+      tableKey: 0,
+      queryParams: initQueryParams(),
+      selection: [],
+      loading: false,
+      tableData: {
+        total: 0,
+      },
+      // 枚举
+      enums: {},
+      // 字典
+      dicts: {},
+    };
+  },
+  computed: {},
+  watch: {},
+  mounted() {
+    this.fetch();
+
+    // 初始化字典和枚举
+    const enumList = [];
+    const dictList = [];
+    loadEnums(enumList, this.enums, "place");
+    initDicts(dictList, this.dicts);
+  },
+  methods: {
+    codeToName(code) {
+      return CodeToText[code];
+    },
+
+    editOne() {
+      if (!this.selection.length) {
+        this.$message({
+          message: this.$t("tips.noDataSelected"),
+          type: "warning",
+        });
+        return;
+      }
+      if (this.selection.length > 1) {
+        this.$message({
+          message: this.$t("tips.mustOne"),
+          type: "warning",
+        });
+        return;
+      }
+      this.edit(this.selection[0]);
+    },
+
+    handleChange() {
+      // this.form.provinces = CodeToText[this.selectedOptions[0]]
+      // this.form.pCode = this.selection[0],
+      //   this.form.city = CodeToText[this.selectedOptions[1]],
+      //   this.form.cCode = this.selectedOptions[1],
+      //   this.form.area = CodeToText[this.selectedOptions[2]]
+      // this.form.aCode = this.selectedOptions[2]
+
+      this.queryParams.model.plcPid = CodeToText[this.selectedOptions[0]];
+      this.queryParams.model.plcCid = CodeToText[this.selectedOptions[1]];
+      this.queryParams.model.plcAid = CodeToText[this.selectedOptions[2]];
+
+      console.log("省市县数据" + JSON.stringify(this.selectedOptions));
+    },
+
+    editClose() {
+      this.dialog.isVisible = false;
+    },
+    editSuccess() {
+      this.search();
+    },
+    onSelectChange(selection) {
+      this.selection = selection;
+    },
+    search() {
+      this.fetch({
+        ...this.queryParams,
+      });
+    },
+    reset() {
+      this.queryParams = initQueryParams();
+      this.selectedOptions = [];
+      this.$refs.table.clearSort();
+      this.$refs.table.clearFilter();
+      this.search();
+    },
+    importExcel() {
+      this.fileImport.type = "upload";
+      this.fileImport.isVisible = true;
+      this.$refs.import.setModel(false);
+    },
+    importSuccess() {
+      this.search();
+    },
+    importClose() {
+      this.fileImport.isVisible = false;
+    },
+    singleDelete(row) {
+      this.$refs.table.clearSelection();
+      this.$refs.table.toggleRowSelection(row, true);
+      this.batchDelete();
+    },
+    batchDelete() {
+      if (!this.selection.length) {
+        this.$message({
+          message: this.$t("tips.noDataSelected"),
+          type: "warning",
+        });
+        return;
+      }
+      this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), {
+        confirmButtonText: this.$t("common.confirm"),
+        cancelButtonText: this.$t("common.cancel"),
+        type: "warning",
+      })
+        .then(() => {
+          const ids = this.selection.map((u) => u.id);
+          this.delete(ids);
+        })
+        .catch(() => {
+          this.clearSelections();
+        });
+    },
+    clearSelections() {
+      this.$refs.table.clearSelection();
+    },
+    delete(ids) {
+      adc.delete({ ids: ids }).then((response) => {
+        const res = response.data;
+        if (res.isSuccess) {
+          this.$message({
+            message: this.$t("tips.deleteSuccess"),
+            type: "success",
+          });
+          this.search();
+        }
+      });
+    },
+    add() {
+      this.dialog.type = "add";
+      this.dialog.isVisible = true;
+      this.$refs.edit.setPlace(false);
+      // this.selectedOptions=[];
+    },
+    edit(row) {
+      // this.$refs.edit.setPlace({row, enums: this.enums, dicts: this.dicts});
+      this.$refs.edit.setPlace({ row });
+      this.dialog.type = "edit";
+      this.dialog.isVisible = true;
+    },
+    fetch(params = {}) {
+      this.loading = true;
+      this.queryParams.current = params.current
+        ? params.current
+        : this.queryParams.current;
+      this.queryParams.size = params.size ? params.size : this.queryParams.size;
+      adc
+        .page(this.queryParams)
+        .then((response) => {
+          const res = response.data;
+          if (res.isSuccess) {
+            this.tableData = res.data;
+          }
+        })
+        .finally(() => (this.loading = false));
+    },
+    sortChange(val) {
+      this.queryParams.sort = val.prop;
+      this.queryParams.order = val.order;
+      if (this.queryParams.sort) {
+        this.search();
+      }
+    },
+    filterChange(filters) {
+      for (const key in filters) {
+        if (key.includes(".")) {
+          const val = {};
+          val[key.split(".")[1]] = filters[key][0];
+          this.queryParams.model[key.split(".")[0]] = val;
+        } else {
+          this.queryParams.model[key] = filters[key][0];
+        }
+      }
+      this.search();
+    },
+    cellClick(row, column) {
+      if (column["columnKey"] === "operation") {
+        return;
+      }
+      let flag = false;
+      this.selection.forEach((item) => {
+        if (item.id === row.id) {
+          flag = true;
+          this.$refs.table.toggleRowSelection(row);
+        }
+      });
+
+      if (!flag) {
+        this.$refs.table.toggleRowSelection(row, true);
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped></style>

+ 270 - 0
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/ad/client/components/Edit.vue

@@ -0,0 +1,270 @@
+<!--
+ * @Author: wangj
+ * @Date: 2023-02-19 13:54:14
+ * @LastEditors: @EXtreeDesigner
+ * @LastEditTime: 2023-03-04 17:50:38
+ * @FilePath: \imcs-ui\src\views\zuihou\ad\client\components\Edit.vue
+ * @Description: 
+-->
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="true"
+    :title="title"
+    :type="type"
+    :visible.sync="isVisible"
+    :width="width"
+    top="50px"
+    v-el-drag-dialog
+  >
+    <el-form
+      :model="place"
+      :rules="rules"
+      label-position="right"
+      label-width="180px"
+      ref="form"
+    >
+    <!-- 客户名称 -->
+      <el-form-item :label="$t('_ad.add.0')" prop="customerName">
+        <el-input v-model.trim="place.customerName" :placeholder="$t('_ad.add.0')" />
+      </el-form-item>
+      <!-- 联系人 -->
+      <el-form-item :label="$t('_ad.add.1')" prop="contactName">
+        <el-input
+          v-model.trim="place.contactName"
+          :placeholder="$t('_ad.add.1')"
+        />
+      </el-form-item>
+      <!-- 联系手机 -->
+      <el-form-item :label="$t('_ad.add.2')" prop="contactPhone">
+        <el-input
+          v-model.trim="place.contactPhone"
+          :placeholder="$t('_ad.add.2')"
+          type="tel"
+          @input="inputTel"
+        />
+      </el-form-item>
+      <!-- 备注 -->
+      <el-form-item :label="$t('_ad.add.3')" prop="plcEvnType">
+        <el-input
+          type="textarea"
+          v-model="place.customerRemark"
+          :placeholder="$t('_ad.add.3')"
+        />
+      </el-form-item>
+      <!-- 状态 -->
+      <el-form-item :label="$t('_ad.add.4')" prop="plcStatus">
+        <template>
+          <el-radio v-model="place.customerStatus" label="1">{{
+            $t("bt.status.enable")
+          }}</el-radio>
+          <el-radio v-model="place.customerStatus" label="0">{{
+            $t("bt.status.blocked")
+          }}</el-radio>
+        </template>
+      </el-form-item>
+    </el-form>
+    <div class="dialog-footer" slot="footer">
+      <el-button @click="isVisible = false" plain type="warning">
+        {{ $t("common.cancel") }}
+      </el-button>
+      <el-button
+        @click="submitForm"
+        :disabled="confirmDisabled"
+        plain
+        type="primary"
+      >
+        {{ $t("common.confirm") }}
+      </el-button>
+    </div>
+  </el-dialog>
+</template>
+<script>
+import elDragDialog from "@/directive/el-drag-dialog";
+import { adc } from "@/api/adSomeelse";
+
+export default {
+  name: "PlaceEdit",
+  directives: { elDragDialog },
+  components: {},
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    type: {
+      type: String,
+      default: "add",
+    },
+  },
+  data() {
+    const phonecheck = (rule, value, callback) => {
+        if (value.length != 11) {
+          callback(new Error('请输入正确的手机号码'));
+        } else {
+          callback();
+        }
+      };
+    return {
+      confirmDisabled: false,
+      place: this.initPlace(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      rules: {
+        customerName: [
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+        ],
+        contactName: [
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+        ],
+        contactPhone: [
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+          { validator: phonecheck, trigger: 'blur' }
+        ],
+      },
+    };
+  },
+  computed: {
+    isVisible: {
+      get() {
+        return this.dialogVisible;
+      },
+      set() {
+        this.close();
+        this.reset();
+      },
+    },
+    title() {
+      return this.$t("common." + this.type);
+    },
+    res: function () {
+      const r = JSON.parse(JSON.stringify(this.place));
+      r.regionIds = this.place.regionIds.join();
+      return r;
+    },
+  },
+  watch: {},
+  mounted() {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth();
+      })();
+    };
+  },
+  methods: {
+    setPlace(e){
+      if (e){
+        const {row} = e
+        this.place = JSON.parse(JSON.stringify(row))
+      }else{
+        this.place = this.initPlace()
+      }
+    },
+    initPlace() {
+      return {
+        id: "",
+        contactName: "",
+        contactPhone: "",
+        customerName: "",
+        customerRemark: "",
+        customerStatus: "",
+      };
+    },
+    inputTel(e){
+      const res = parseInt(e)
+      this.place.contactPhone = isNaN(res) ? '' : res.toString();
+    },
+    initWidth() {
+      this.screenWidth = document.body.clientWidth;
+      if (this.screenWidth < 991) {
+        return "90%";
+      } else if (this.screenWidth < 1400) {
+        return "45%";
+      } else {
+        return "800px";
+      }
+    },
+    close() {
+      this.$emit("close");
+    },
+    reset() {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate();
+      this.$refs.form.resetFields();
+      this.confirmDisabled = false;
+      this.place = this.initPlace();
+    },
+    submitForm() {
+      const vm = this;
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          vm.editSubmit();
+        } else {
+          return false;
+        }
+      });
+    },
+    editSubmit() {
+      const vm = this;
+      if (vm.type === "edit") {
+        vm.update();
+      } else {
+        vm.save();
+      }
+    },
+    save() {
+      const vm = this;
+      vm.confirmDisabled = true;
+      adc
+        .save(this.place)
+        .then((response) => {
+          const res = response.data;
+          if (res.isSuccess) {
+            vm.isVisible = false;
+            vm.$message({
+              message: vm.$t("tips.createSuccess"),
+              type: "success",
+            });
+            vm.$emit("success");
+          }
+        })
+        .finally(() => (vm.confirmDisabled = false));
+    },
+    update() {
+      const vm = this;
+      vm.confirmDisabled = true;
+      adc
+        .update(this.place)
+        .then((response) => {
+          const res = response.data;
+          if (res.isSuccess) {
+            vm.isVisible = false;
+            vm.$message({
+              message: this.$t("tips.updateSuccess"),
+              type: "success",
+            });
+            vm.$emit("success");
+          }
+        })
+        .finally(() => (vm.confirmDisabled = false));
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.from-item {
+  width: 100%;
+}
+</style>