wangzhuo 1 年之前
父節點
當前提交
ae8e639e32

+ 10 - 6
src/enums/column-name.js

@@ -1217,19 +1217,19 @@ const columnName = [{
 {
   code: 277.3,
   name: '轮胎商城-统计分析-客户往来-销售列表'
-}, 
+},
 {
   code: 277.4,
   name: '轮胎商城-统计分析-客户往来-资金往来'
-}, 
+},
 {
   code: 278,
   name: '轮胎商城-统计分析-供应商往来-销售列表'
-}, 
+},
 {
   code: 278.1,
   name: '轮胎商城-统计分析-供应商往来-资金往来'
-}, 
+},
 {
   code: 279,
   name: '轮胎库存锁定明细'
@@ -1237,11 +1237,15 @@ const columnName = [{
 {
   code: 280,
   name: '上架管理导入库存弹窗'
-}, 
+},
 {
   code: 281,
   name: '收付款结算导入销售明细'
-}, 
+},
+  {
+    code: 282,
+    name: '设备维修'
+  }
 ]
 export const getColumnName = (key) => {
   for (let index = 0; index < columnName.length; index++) {

+ 61 - 2
src/views/EquipmentArchives/detailsPage.vue

@@ -78,6 +78,12 @@
             }}</el-button>
             <el-button size="small" type="text" :disabled="option.disabled" @click="rowDel(row, index)">删除
             </el-button>
+            <el-button
+              size="small"
+              type="text"
+              @click="annexOpen(row, index)"
+            >附 件
+            </el-button>
           </template>
         </avue-crud>
       </trade-card>
@@ -148,6 +154,26 @@
           </span>
         </el-dialog>
     </div>
+
+
+    <el-dialog
+      title="附件"
+      :visible.sync="enclosure"
+      append-to-body
+      width="70%">
+      <c-upload
+        typeUpload="GZ"
+        :basic="true"
+        deleteUrl="/api/blade-client/common-file/remove"
+        :data="orderList"
+        :enumerationValue="111"
+      ></c-upload>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="enclosure = false" size="small">取 消</el-button>
+          <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>
+        </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -168,6 +194,7 @@ import {
     corpequipmentarchivesSubmit
 } from "@/api/basicData/EquipmentArchives";
 import { getGoodstype } from "@/api/basicData/product";
+import {getFee, saveFile} from "../../api/landTransportation";
 export default {
   name: "index",
   data() {
@@ -185,7 +212,8 @@ export default {
 
       },
       data: [],
-
+      enclosure: false,
+      orderList: [],
       option: {
         menuBtn: false,
         labelWidth: 90,
@@ -560,7 +588,37 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    //打开附件
+    annexOpen(row, index) {
+      if (row.id) {
+        this.enclosure = true
+        this.formAnnex = row
+        getFee({id: row.id}).then(res => {
+          this.orderList = res.data.data
+        })
+      } else {
+        this.$message.error('请保存后再上传附件');
+      }
+    },
+    //保存
+    saveAnnex() {
+      for (const key in this.orderList) {
+        this.orderList[key].sort = Number(key) + 1
+        this.orderList[key].typeFiles = this.orderList[key].paymentType
+      }
+      console.log(this.orderList)
+
+      this.enclosure = false
 
+      // saveFile({
+      //   id: this.formAnnex.id,
+      //   fileList: this.orderList
+      // }).then(res => {
+      //   console.log(res)
+      //   this.$message.success("保存成功");
+      //   this.annexOpen(this.formAnnex)
+      // })
+    },
     amountChange() {
       let val = 0
       this.data.forEach(e => {
@@ -723,7 +781,8 @@ export default {
                 contactsTel:this.form.contactsTel,
                 address:this.form.address,
                 remarks:this.form.remarks,
-                corpEquipmentArchivesItemList:arr
+                corpEquipmentArchivesItemList:arr,
+                filesList:this.orderList
             }
             this.loadingBtn = true;
             // 附件

+ 73 - 2
src/views/maintenanceQ/detailsPage.vue

@@ -10,7 +10,7 @@
         <div class="add-customer-btn">
           <!--<el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印-->
           <!--</el-button>-->
-            <el-button v-if="form.dispatchingWorkers == 2" type="warning" size="small" :disabled="option.disabled" @click="editCustomer(2)">
+            <el-button v-if="form.dispatchingWorkers == 2" type="warning" size="small" :disabled="option.dispatchWorkers" @click="editCustomer(2)">
                 撤销派工
             </el-button>
             <el-button v-else type="warning" size="small" :disabled="option.disabled && (form.dispatchingWorkers == 0 || form.dispatchingWorkers == 1)" @click="editCustomer(1)">
@@ -18,7 +18,7 @@
             </el-button>
 
           <el-button type="primary" size="small"
-            class="el-button--small-yh"  :disabled="!option.disabled" @click.stop="openEdit">编辑
+            class="el-button--small-yh" :disabled="!option.disabled" @click.stop="openEdit">编辑
           </el-button>
           <el-button type="primary" size="small" :disabled="option.disabled" @click="editCustomer(0)">
             保存数据
@@ -33,6 +33,28 @@
           <!--    -->
           <!--</template>-->
 
+          <template slot="deviceName">
+            <el-select v-model="form.deviceName" @change='deviceNameChange' filterable placeholder="请选择设备">
+              <el-option
+                v-for="item in deviceList"
+                :key="item.cname"
+                :label="item.cname"
+                :value="item.cname">
+              </el-option>
+            </el-select>
+          </template>
+
+          <template slot="maintenanceWorkerId">
+            <el-select v-model="form.maintenanceWorkerId"  @change='maintenanceWorkerIdChange' filterable placeholder="请选择维修工">
+              <el-option
+                v-for="item in maintenanceWorkersList"
+                :key="item.id"
+                :label="item.realName"
+                :value="item.id">
+              </el-option>
+            </el-select>
+          </template>
+
             <template slot="maintenanceAmount">
                 <el-input v-model="form.maintenanceAmount" type="number" disabled
                           placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input>
@@ -109,11 +131,17 @@ import {
     corpequipmentarchivesitemList,
     corpequipmentarchivesList,
 } from "@/api/basicData/EquipmentArchives";
+import {date} from "mockjs/src/mock/random/date";
 export default {
   name: "index",
   data() {
     return {
 
+      // 设备list
+      deviceList: [],
+      // 维修工list
+      maintenanceWorkersList: [],
+
       loadingBtn: false,
       addressTitle: null,
       form: {},
@@ -128,6 +156,7 @@ export default {
         menuBtn: false,
         labelWidth: 90,
         disabled: false,
+        dispatchWorkers: false,
         column: [
           {
             label: "客户名称",
@@ -156,6 +185,7 @@ export default {
                           // 设备名称
                           corpequipmentarchivesitemList({pid:item.id}).then(res=>{
                               this.findObject(this.option.column, "deviceName").dicData = res.data.data.records
+                              this.deviceList = res.data.data.records
                           })
                           break;
                       }
@@ -325,9 +355,17 @@ export default {
     if (this.detailData.id) {
         this.option.disabled = true
       this.getDetail(this.detailData.id);
+    } else {
+      // 报修日期默认当天
+      var time = new Date();
+      var day = ("0" + time.getDate()).slice(-2);
+      var month = ("0" + (time.getMonth() + 1)).slice(-2);
+      var today = time.getFullYear() + "-" + month + "-" + day;
+      this.form.repairReportDate = today;
     }
     if (this.detailData.status == 1) {
       this.option.disabled = true;
+      this.option.dispatchWorkers = true;
     }
 
   },
@@ -341,12 +379,38 @@ export default {
             this.findObject(this.option.column, "corpName").dicData = res.data.data.records
         })
         bladeUserList({roleAlias:'维修工'}).then(res=>{
+          console.log(res.data.data)
             this.findObject(this.option.column, "maintenanceWorkerId").dicData = res.data.data
+            this.maintenanceWorkersList = res.data.data
+          console.log(this.maintenanceWorkersList)
+
         })
     },
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    deviceNameChange(cname) {
+      for (const item of this.deviceList) {
+        if (item.cname == cname) {
+
+          this.form.deviceId = item.id
+          this.form.deviceDescribe = item.cname
+
+          this.form.categoryitem = item.categoryitem
+          this.form.categoryitemId = item.categoryitemId
+          this.form.factoryId = item.factoryId
+          this.form.factoryName = item.factoryName
+        }
+      }
+    },
+    maintenanceWorkerIdChange(id) {
+      for (const item of this.maintenanceWorkersList) {
+        if (item.id == id) {
+          this.form.maintenanceWorkerName = item.name
+          this.form.maintenanceWorkerTel = item.phone
+        }
+      }
+    },
       // 维修项目的失焦事件
       amountblur(){
         let sum = 0
@@ -530,6 +594,7 @@ export default {
               this.data = res.data.data.maintenanceFees;
               this.maintenanceFiles = res.data.data.maintenanceFiles ? res.data.data.maintenanceFiles : [];
               this.option.disabled = true;
+              this.option.dispatchWorkers = true;
           })
       },
       // 撤销派工
@@ -540,6 +605,7 @@ export default {
               this.data = res.data.data.maintenanceFees;
               this.maintenanceFiles = res.data.data.maintenanceFiles ? res.data.data.maintenanceFiles : [];
               this.option.disabled = true;
+              this.option.dispatchWorkers = true;
           })
       },
       // 保存接口
@@ -550,6 +616,7 @@ export default {
               // this.maintenanceFiles = res.data.data.maintenanceFiles ? res.data.data.maintenanceFiles : [];
               this.detailData.status = 1
               this.option.disabled = true;
+              this.option.dispatchWorkers = true;
 
               if (index == 0) {
                   this.$message.success("保存成功");
@@ -590,7 +657,11 @@ export default {
     },
     openEdit() {
       // this.detailData.status = 2
+      if (this.form.dispatchingWorkers == 2) {
+        this.option.dispatchWorkers = false
+      } else {
         this.option.disabled = false
+      }
       // this.option = this.$options.data().option;
       // this.$refs.crud.refreshTable();
     },

+ 217 - 0
src/views/tirePartsMall/basicData/equipmentService/detailsPage.vue

@@ -0,0 +1,217 @@
+<template>
+  <div>
+    <div class="customer-head">
+      <div class="customer-back">
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
+                   @click="backToList(0)">返回列表
+        </el-button>
+      </div>
+      <div class="add-customer-btn">
+        <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
+        <!--                   @click="confirmEditing">编辑-->
+        <!--        </el-button>-->
+        <el-button
+          class="el-button--small-yh"
+          type="primary"
+          size="small"
+          @click="editCustomer">保存数据
+        </el-button>
+        <el-button
+          class="el-button--small-yh"
+          type="primary"
+          size="small"
+          @click="enableNot"
+          v-if="form.id">
+          {{ form.enableOrNot == 0 ? '启用' : '禁用' }}
+        </el-button>
+      </div>
+    </div>
+    <div style="margin-top: 50px">
+      <trade-card title="基础信息">
+        <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
+      </trade-card>
+      <trade-card title="附件信息  (图片文件像素推荐700X750,有且只允许有一张主图,其余均为副图)">
+        <c-upload
+          basic
+          :data="form.brandFilesList"
+          :disabled="disabled"
+          deleteUrl="/api/blade-sales-part/brandfiles/remove"
+          :enumerationValue="272.1"
+          display
+        />
+        <!-- <span style="font-size: 12px;">(图片文件像素推荐700X750,有且只允许有一张主图,其余均为副图)</span> -->
+      </trade-card>
+    </div>
+  </div>
+</template>
+
+<script>
+// import {submit} from "@/api/tirePartsMall/basicData/customerInformation";
+import {submit, getDetails, updateEnableOrNot} from "@/api/tirePartsMall/basicData/brandPage";
+import it from "element-ui/src/locale/lang/it";
+
+export default {
+  name: "detailsPage",
+  data() {
+    return {
+      disabled: false,
+      form: {
+        brandFilesList: []
+      },
+      optionForm: {
+        menuBtn: false,
+        span: 8,
+        column: [{
+          label: '名称',
+          prop: "cname",
+          rules: [{
+            required: true,
+            message: " ",
+            trigger: "blur"
+          }]
+        }, {
+          label: '制单人',
+          prop: "createUserName",
+          disabled: true
+        }, {
+          label: '制单日期',
+          prop: "createTime",
+          disabled: true
+        }, {
+          label: '类型',
+          prop: "type",
+          type: 'select',
+          dicData: [{
+            label: 'PP',
+            value: 'PP'
+          }, {
+            label: 'GN',
+            value: 'GN'
+          }]
+        }, {
+          label: '排序',
+          prop: "sort",
+          type:'number'
+        }, {
+          label: '备注',
+          prop: "remarks",
+          type: 'textarea',
+          span: 24,
+          minRows: 2
+        }]
+      },
+      formContacts: {},
+    }
+  },
+  props: {
+    onLoad: Object,
+    detailData: Object
+  },
+  async created() {
+    if (this.onLoad.id && this.detailData.id) {
+      this.refresh(this.onLoad.id, true)
+    } else if (this.onLoad.id) {
+      this.refresh(this.onLoad.id, true)
+    }
+  },
+  methods: {
+    refresh(id, type) {
+      const loading = this.$loading({
+        lock: true,
+        text: '加载中',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255,255,255,0.7)'
+      })
+      getDetails({id: id}).then(res => {
+        this.form = res.data.data
+        loading.close();
+      }).catch(() => {
+        loading.close();
+      })
+    },
+    //是否启用
+    enableNot() {
+      const {brandFilesList, ...formWithoutBrandFilesList} = this.form;
+      const loading = this.$loading({
+        lock: true,
+        text: '加载中',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255,255,255,0.7)'
+      })
+      updateEnableOrNot({
+        ...formWithoutBrandFilesList,
+        enableOrNot: this.form.enableOrNot == 0 ? 1 : 0
+      }).then(res => {
+        loading.close()
+        this.$message.success("操作成功")
+        this.refresh(this.form.id)
+      }).catch(() => {
+        loading.close()
+      })
+    },
+    //修改提交触发
+    editCustomer() {
+      if (this.form.brandFilesList.length === 0) {
+        return this.$message.error("请上传主图")
+      }
+      let num = 0
+      for (let item of this.form.brandFilesList) {
+        if (item.version == 0) {
+          num++
+        }
+      }
+      if (num > 1) {
+        return this.$message.error("主图类型重复")
+      }
+      this.$refs["form"].validate((valid, done) => {
+        done();
+        if (valid) {
+          this.loadingBtn = true;
+          submit({
+            ...this.form
+          }).then(res => {
+            this.$message.success("保存成功");
+            this.refresh(res.data.data.id)
+          }).finally(() => {
+            this.loadingBtn = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    //自定义列保存
+    async saveColumnTwo(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumnTwo(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    backToList(type) {
+      this.$emit("backToList", type);
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-form-item {
+  margin-bottom: 8px !important;
+}
+</style>

+ 258 - 0
src/views/tirePartsMall/basicData/equipmentService/index.vue

@@ -0,0 +1,258 @@
+<template>
+  <div>
+    <basic-container v-show="!detailsOpen">
+      <avue-crud
+          :option="option"
+          :search.sync="search"
+          v-model="form"
+          :table-loading="loading"
+          :data="dataList"
+          ref="crud"
+          :key="key"
+          @on-load="onLoad"
+          @search-change="searchChange"
+          @row-del="rowDel"
+          @refresh-change="refreshChange"
+          @resetColumn="resetColumnTwo('crud','option','optionList',272)"
+          @saveColumn="saveColumnTwo('crud','option','optionList',272)"
+          :page.sync="page">
+        <template slot-scope="{type,size,row,index}" slot="menu">
+          <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
+          <el-button :size="size" :type="type" :disabled="row.enableOrNot" @click="$refs.crud.rowDel(row,index)">删除
+          </el-button>
+        </template>
+        <template slot-scope="{ row, index }" slot="cname">
+              <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.cname }}</span>
+            </template>
+        <template slot="corpNameSearch">
+          <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
+        </template>
+        <template slot-scope="{type,size,row,$index}" slot="menuLeft">
+          <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
+  </div>
+</template>
+
+<script>
+// import {getList, remove} from "@/api/oceanShipping/maritimeExport";
+import {getList, remove} from "@/api/tirePartsMall/basicData/brandPage";
+import detailsPage from "./detailsPage.vue"
+
+export default {
+  name: "index",
+  components: {
+    detailsPage
+  },
+  data() {
+    return {
+      detailsOpen: false,
+      loading: false,
+      search: {},
+      form: {},
+      dataList: [],
+      detailData: {},
+      page: {
+        pageSize: 20,
+        currentPage: 1,
+        total: 0,
+        pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
+      },
+      key: 0,
+      option: {},
+      optionList: {
+        viewBtn: false,
+        editBtn: false,
+        delBtn: false,
+        addBtn: false,
+        index: true,
+        span: 8,
+        border: true,
+        height: "auto",
+        searchMenuPosition: "right",
+        align: "center",
+        size: "small",
+        menuWidth: 50,
+        searchSpan: 8,
+        searchIcon: true,
+        searchIndex: 2,
+        highlightCurrentRow: true,
+        dialogWidth: "70%",
+        column: [{
+          label: '品牌名称',
+          prop: "cname",
+          search: true,
+          overHidden: true,
+        }, {
+          label: "制单人",
+          search: true,
+          prop: "createUserName",
+          searchProp: "createUser",
+          overHidden: true,
+          width: 100,
+          filterable: true,
+          remote: true,
+          type: "select",
+          dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
+          props: {
+            label: "account",
+            value: "id",
+            res: 'data.records'
+          }
+        }, {
+          label: "制单日期",
+          search: true,
+          prop: "createTime",
+          searchProp: "createTimeList",
+          type: "date",
+          overHidden: true,
+          width: 100,
+          searchRange: true,
+          searchDefaultTime: ["00:00:00", "23:59:59"],
+          format: "yyyy-MM-dd",
+          valueFormat: "yyyy-MM-dd HH:mm:ss"
+        }, {
+          label: "更新人",
+          prop: "updateUserName",
+          searchProp: "updateUser",
+          overHidden: true,
+          width: 100,
+          filterable: true,
+          remote: true,
+          type: "select",
+          dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
+          props: {
+            label: "account",
+            value: "id",
+            res: 'data.records'
+          }
+        }, {
+          label: "更新日期",
+          prop: "updateTime",
+          searchProp: "updateTimeList",
+          type: "date",
+          overHidden: true,
+          width: 100,
+          searchRange: true,
+          searchDefaultTime: ["00:00:00", "23:59:59"],
+          format: "yyyy-MM-dd",
+          valueFormat: "yyyy-MM-dd HH:mm:ss"
+        }, {
+          label: '是否启用',
+          prop: "enableOrNot",
+          search: false,
+          overHidden: true,
+          type: 'select',
+          dicData: [{
+            label: '否',
+            value: 0
+          }, {
+            label: '是',
+            value: 1
+          }]
+        }]
+      }
+    }
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(272), this.optionList);
+    this.key++
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0) {
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
+    }
+  },
+  methods: {
+    check(row) {
+      this.form = row
+      this.detailsOpen = true
+    },
+    backToList(type) {
+      this.form = {}
+      this.detailsOpen = false
+      if (type === 0) {
+        this.detailData = {}
+      }
+      this.onLoad(this.page, this.search)
+    },
+    //刷新
+    refreshChange() {
+      this.onLoad(this.page, this.search)
+    },
+    rowDel(form, index) {
+      this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        remove(form.id).then(res => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.dataList.splice(index, 1);
+          this.onLoad(this.page)
+        })
+      }).catch(() => {
+      });
+    },
+    searchChange(params, done) {
+      done();
+      this.page.type = 'PP' +
+        ''
+      console.log(this.page)
+      this.onLoad(this.page, params)
+    },
+    onLoad(page, params = {}) {
+      params = {
+        ...params,
+        current: page.currentPage,
+        size: page.pageSize,
+        ...Object.assign(params, this.search)
+      }
+      this.loading = true
+      getList(params).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+        this.loading = false
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    //自定义列保存
+    async saveColumnTwo(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumnTwo(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>