Prechádzať zdrojové kódy

build(业务参数 -> 订单用途管理):curd去除公司编码名称

snow 2 rokov pred
rodič
commit
555f58afe9

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
dist/static/js/0.js


+ 246 - 0
src/views/serviceParam/orderuse copy/addEdit.vue

@@ -0,0 +1,246 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    shi
+    :center="true"
+    align="left"
+    top="18vh"
+    width="500px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin: -20px 0 0 0">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            label-width="80px"
+            class="demo-ruleForm"
+          >
+            <el-form-item label="业务公司" prop="companyNo">
+              <search-work-company
+                disabled
+                :value="ruleForm.companyNo"
+                :placeholder="'业务公司'"
+                size="large"
+                @searchChange="companyNosearchChange"
+              />
+            </el-form-item>
+
+            <el-form-item label="订单用途" prop="order_use">
+              <el-input
+                v-model="ruleForm.order_use"
+                :disabled="id == '007'"
+                placeholder="订单用途"
+                maxlength="20"
+              />
+            </el-form-item>
+          </el-form>
+        </el-col>
+
+        <el-col :span="24" style="text-align: right">
+          <el-button
+            v-if="id !== '007'"
+            type="primary"
+            @click="submitForm"
+          >保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{
+            id == "007" ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from '@/apis/service/serviceParam/orderuse'
+import resToken from '@/mixins/resToken'
+import companyHelper from '@/mixins/companyHelper'
+import { getUserCompany } from '@/utils/auth'
+
+export default {
+  name: 'Orderuse',
+  mixins: [resToken, companyHelper],
+  props: ['showModel', 'id', 'sitem'],
+  data() {
+    return {
+      loading: false,
+      title: '添加订单用途',
+      showModelThis: this.showModel,
+      select: '1',
+      activeOptions: [],
+      actionList: [],
+      ruleForm: {
+        id: '',
+        order_use: '',
+        companyNo: '',
+        companyName: '',
+        logo_url: ''
+      },
+      rulesThis: this.rules,
+      rules: {
+        order_use: [
+          { required: true, message: '订单用途不能为空!', trigger: 'blur' }
+        ],
+        companyNo: [
+          { required: true, message: '请选择业务公司!', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    showModel: function(val) {
+      this.showModelThis = val
+      if (val) {
+        this.initForm()
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit('cancel')
+      }
+    }
+  },
+  methods: {
+    async initForm() {
+      this.loading = true
+      if (this.id === '003') {
+        this.title = '添加订单用途'
+        this.rulesThis = this.rules
+      } else if (this.id === '005') {
+        this.title = '修改订单用途'
+        this.rulesThis = this.rules
+      } else {
+        this.title = '订单用途详情'
+        this.rulesThis = {}
+      }
+      await this.resetForm()
+      this.loading = false
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
+          console.log(this.sitem)
+
+          const { id, order_use, companyNo, companyName } = this.sitem
+          this.ruleForm = {
+            companyName,
+            id: id || '',
+            companyNo: companyNo || '',
+            order_use: order_use || ''
+          }
+
+          if (this.id === '003') {
+            const company = getUserCompany()
+            console.log(company)
+
+            this.ruleForm.companyNo = this.currentCompany
+            this.ruleForm.companyName = company ? company.name : ''
+          }
+        }
+      })
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async(valid) => {
+        if (valid) {
+          if (this.loading) {
+            return
+          }
+
+          this.loading = true
+          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          let res = {}
+          if (this.id === '003') {
+            delete model['id']
+            res = await asyncRequest.add(model)
+          } else {
+            res = await asyncRequest.update(model)
+          }
+          this.loading = false
+          if (res && res.code === 0) {
+            const title = this.id === 'add' ? '添加成功!' : '修改成功!'
+            this.$notify.success({
+              title,
+              message: ''
+            })
+            this.showModelThis = false
+            // 刷新
+            this.$emit('refresh')
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout()
+          } else {
+            this.$message.warning(res.message)
+          }
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 判断图片规格
+    beforeAvatarUpload(file) {
+      let isJPG = false
+      let isLt2M = false
+      if (file) {
+        if (
+          file.type === 'image/jpg' ||
+          file.type === 'image/png' ||
+          file.type === 'image/jpeg'
+        ) {
+          isJPG = true
+        }
+        isLt2M = file.size / 1024 / 1024 < 1
+        if (!isJPG) {
+          this.$message.error('图片格式不正确!')
+        }
+        if (!isLt2M) {
+          this.$message.error('图片大小不能超过 1MB!')
+        }
+      }
+
+      return isJPG && isLt2M
+    },
+    async companyNosearchChange(e) {
+      const { code, label } = e
+      this.ruleForm.companyNo = code || ''
+      this.ruleForm.companyName = label
+    },
+    // 图片上传失败
+    UploadErrorEvent(res) {
+      if (res !== 'break') {
+        this.$message.error('图片上传失败!')
+        this.ruleForm.logo_url = ''
+        this.$refs.ruleForm.validateField('logo_url')
+      }
+    },
+    // 图片上传成功
+    async UploadSuccessEvent(data) {
+      const { url } = data
+      if (url === 'noToken') {
+        await this.logout()
+      } else {
+        this.ruleForm.logo_url = url
+        this.$message.success('图片上传成功!')
+        this.$refs.ruleForm.validateField('logo_url')
+      }
+    }
+  }
+}
+</script>
+
+   <style lang="scss" scoped>
+.orderuse {
+}
+</style>

+ 467 - 0
src/views/serviceParam/orderuse copy/index.vue

@@ -0,0 +1,467 @@
+<template>
+  <div class="orderuse pagePadding">
+    <ex-table
+      v-loading="loading"
+      v-if=" powers.some((i) => i == '001')"
+      :table="table"
+      :data="tableData"
+      :columns="columns"
+      :page="pageInfo"
+      :size="size"
+      @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange"
+      @screen-reset="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+      @screen-submit="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+    >
+      <template #table-header="{}">
+        <div style="width: 100%">
+          <el-row style="padding: 0 0 10px 80px">
+            <el-col :span="6" style="width: 303px">
+              <period-date-picker
+                :type="1"
+                :width="'135px'"
+                :size="searchSize"
+                :start="parmValue.start"
+                :end="parmValue.end"
+                @timeReturned="handleTime"
+              />
+            </el-col>
+            <el-col :span="4" style="width: 160px">
+              <el-select
+                v-model="parmValue.status"
+                filterable
+                clearable
+                :size="searchSize"
+                placeholder="订单用途状态"
+                style="width: 100%"
+                @change="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              >
+                <el-option
+                  v-for="item in statusList"
+                  :key="'status' + item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+            </el-col>
+
+            <el-col
+              :span="3"
+              class="fr"
+              style="width: 66px; padding: 0 0 0 10px"
+            >
+              <el-button type="primary" :size="searchSize" @click="searchList">
+                刷新
+              </el-button>
+            </el-col>
+            <el-col
+              :span="3"
+              class="fr"
+              style="width: 66px; padding: 0 0 0 10px"
+            >
+              <el-button type="warning" :size="searchSize" @click="restSearch">
+                重置
+              </el-button>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="4" style="width: 373px">
+              <el-input
+                :size="searchSize"
+                v-model="parmValue.order_use"
+                :maxlength="40"
+                @blur="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+                placeholder="订单用途名称"
+              ></el-input>
+            </el-col>
+            <el-col :span="4" style="width: 170px; padding: 0 0 0 10px">
+              <el-input
+                :size="searchSize"
+                v-model="parmValue.creater"
+                :maxlength="40"
+                @change="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+                placeholder="创建人"
+              ></el-input>
+            </el-col>
+            <el-col
+              :span="3"
+              class="fr"
+              style="width: 66px; padding: 0 0 0 10px"
+              v-if="powers.some((i) => i == '003')"
+            >
+              <el-button
+                :size="searchSize"
+                type="success"
+                style="float: right"
+                @click="openModal({}, '003')"
+              >
+                添加
+              </el-button>
+            </el-col>
+          </el-row>
+        </div></template
+      >
+      <template #status="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          :type="scope.row.status == '0' ? 'warning' : ''"
+          v-text="
+            (statusOptions.find((item) => item.id == scope.row.status) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #operation="{ scope }">
+        <el-tooltip
+          v-if="powers.some((i) => i == '007')"
+          effect="dark"
+          content="详情"
+          placement="top"
+        >
+          <i
+            class="el-icon-view tb-icon"
+            @click="openModal(scope.row, '007')"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="powers.some((i) => i == '005')"
+          effect="dark"
+          content="修改"
+          placement="top"
+        >
+          <i
+            class="el-icon-edit tb-icon"
+            @click="openModal(scope.row, '005')"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="
+            powers.some((i) => i == '004') && scope.row.status + '' === '1'
+          "
+          effect="dark"
+          content="禁用"
+          placement="top"
+        >
+          <i
+            class="el-icon-video-pause tb-icon"
+            @click="changeStatus(scope.row.id, scope.row.status)"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="
+            powers.some((i) => i == '004') && scope.row.status + '' === '0'
+          "
+          effect="dark"
+          content="启用"
+          placement="top"
+        >
+          <i
+            class="el-icon-video-play tb-icon"
+            @click="changeStatus(scope.row.id, scope.row.status)"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="powers.some((i) => i == '006')"
+          effect="dark"
+          content="删除"
+          placement="top"
+        >
+          <i
+            class="el-icon-delete tb-icon"
+            @click="deleteItem(scope.row.id)"
+          ></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
+    <no-auth v-else></no-auth>
+    <!-- 弹窗 新增/修改 -->
+    <add-edit
+      :id="modelId"
+      :show-model="showModel"
+      :sitem="sitem"
+      @refresh="searchList"
+      @cancel="showModel = false"
+    />
+  </div>
+</template>
+<script>
+import addEdit from "./addEdit";
+import asyncRequest from "@/apis/service/serviceParam/orderuse";
+import {statusList} from "@/assets/js/statusList";
+import roleLevel from "@/assets/js/roleLevel";
+import mixinPage from "@/mixins/elPaginationHandle";
+import { mapGetters } from "vuex";
+import resToken from "@/mixins/resToken";
+import companyHelper from "@/mixins/companyHelper"
+
+export default {
+  name: "orderuse",
+  mixins: [mixinPage, resToken, companyHelper],
+  components: {
+    addEdit,
+  },
+  computed: {
+    //组件SIZE设置
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      const tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "orderuse"
+        ) || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+  },
+  data() {
+    return {
+      statusList: statusList,
+      roleLevel: roleLevel,
+      loading: true,
+      showModel: false,
+      modelId: "000",
+      sitem: {},
+      parmValue: {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        order_use:"",
+        status: "",
+        company_name: "", //创建人部门
+        creater: "",
+      },
+      // 状态
+      statusOptions: [
+        { id: "0", label: "禁用" },
+        { id: "1", label: "启用" },
+      ],
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "id",
+          label: "ID",
+          width:"80px"
+        },
+        {
+          prop: "order_use",
+          label: "订单用途名称",
+        },
+        {
+          prop: "status",
+          label: "状态",
+          // sortable: true,
+          _slot_: "status",
+        },
+        {
+          prop: "creater",
+          label: "创建人",
+        },
+        {
+          prop: "companyNo",
+          label: "公司编码",
+          minWidth: "150px",
+        },
+        {
+          prop: "companyName",
+          label: "公司名称",
+          minWidth: "150px",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          // sortable: true,
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          minWidth: "90px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.parmValue = {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        order_use:"",
+        status: "",
+        company_name: "", //创建人部门
+        creater: "",
+      };
+      this.searchList();
+    },
+    // 新建/编辑/详情
+    openModal(row, type) {
+      const {status}=row
+       if (type === "005" && status + '' === "1") {
+        this.$message.warning("禁用后,才可以修改!");
+        return;
+      }
+      this.sitem = row;
+      this.modelId = type;
+      this.showModel = true;
+    },
+    // 时间
+    async handleTime(e) {
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.start === "" && this.parmValue.end === "")
+      ) {
+        this.pageInfo.curr = 1;
+        this.parmValue.page = 1;
+        await this.searchList();
+      }
+    },
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     */
+    async changeStatus(id, status) {
+      await this.$confirm(`确定要改为${status + '' === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status + '' === "1" ? "0" : "1",
+          };
+          
+          const res = await asyncRequest.status({
+            ...model,
+            needRela: true
+          });
+
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.loading = false;
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async deleteItem(id) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+          };
+          const res = await asyncRequest.delete(model);
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    // 刷新表格
+    async searchList() {
+         if (
+        (this.parmValue.start !== "" && this.parmValue.end === "") ||
+        (this.parmValue.start == "" && this.parmValue.end != "")
+      ) {
+        this.$message.warning("开始时间和结束时间不能为空");
+        return;
+      }
+      this.loading = true;
+      
+      const res = await asyncRequest.list({
+        ...this.parmValue,
+        needRela: true
+      });
+
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 0 - 0
src/views/serviceParam/orderuse copy/订单用途管理


+ 7 - 7
src/views/serviceParam/orderuse/addEdit.vue

@@ -25,7 +25,7 @@
             label-width="80px"
             class="demo-ruleForm"
           >
-            <el-form-item label="业务公司" prop="companyNo">
+            <!-- <el-form-item label="业务公司" prop="companyNo">
               <search-work-company
                 disabled
                 :value="ruleForm.companyNo"
@@ -33,7 +33,7 @@
                 size="large"
                 @searchChange="companyNosearchChange"
               />
-            </el-form-item>
+            </el-form-item> -->
 
             <el-form-item label="订单用途" prop="order_use">
               <el-input
@@ -82,18 +82,18 @@ export default {
       ruleForm: {
         id: '',
         order_use: '',
-        companyNo: '',
-        companyName: '',
+        // companyNo: '',
+        // companyName: '',
         logo_url: ''
       },
       rulesThis: this.rules,
       rules: {
         order_use: [
           { required: true, message: '订单用途不能为空!', trigger: 'blur' }
-        ],
-        companyNo: [
-          { required: true, message: '请选择业务公司!', trigger: 'blur' }
         ]
+        // companyNo: [
+        //   { required: true, message: '请选择业务公司!', trigger: 'blur' }
+        // ]
       }
     }
   },

+ 14 - 27
src/views/serviceParam/orderuse/index.vue

@@ -103,19 +103,6 @@
                 placeholder="创建人"
               ></el-input>
             </el-col>
-            <!-- <el-col :span="4" style="width: 170px; padding: 0 0 0 10px">
-              <el-input
-                :size="searchSize"
-                v-model="parmValue.company_name"
-                :maxlength="40"
-                @change="
-                  pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-                placeholder="创建人部门"
-              ></el-input>
-            </el-col> -->
             <el-col
               :span="3"
               class="fr"
@@ -226,11 +213,11 @@ import roleLevel from "@/assets/js/roleLevel";
 import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
-import companyHelper from "@/mixins/companyHelper"
+// import companyHelper from "@/mixins/companyHelper"
 
 export default {
   name: "orderuse",
-  mixins: [mixinPage, resToken, companyHelper],
+  mixins: [mixinPage, resToken],
   components: {
     addEdit,
   },
@@ -304,16 +291,16 @@ export default {
           prop: "creater",
           label: "创建人",
         },
-        {
-          prop: "companyNo",
-          label: "公司编码",
-          minWidth: "150px",
-        },
-        {
-          prop: "companyName",
-          label: "公司名称",
-          minWidth: "150px",
-        },
+        // {
+        //   prop: "companyNo",
+        //   label: "公司编码",
+        //   minWidth: "150px",
+        // },
+        // {
+        //   prop: "companyName",
+        //   label: "公司名称",
+        //   minWidth: "150px",
+        // },
         {
           prop: "addtime",
           label: "创建时间",
@@ -397,7 +384,7 @@ export default {
           
           const res = await asyncRequest.status({
             ...model,
-            needRela: true
+            noRelation: true
           });
 
           if (res && res.code === 0) {
@@ -458,7 +445,7 @@ export default {
       
       const res = await asyncRequest.list({
         ...this.parmValue,
-        needRela: true
+        noRelation: true
       });
 
       if (res && res.code === 0 && res.data) {

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov