linwenxin 9 hónapja
szülő
commit
b95cc476c1
22 módosított fájl, 3689 hozzáadás és 1703 törlés
  1. 57 0
      src/api/AuxiliaryAccessoriesWarehouse.js
  2. 109 0
      src/api/GoodsTransferPeceipt.js
  3. 218 0
      src/views/auxiliaryFittings/AuxiliaryAccessoriesWarehouse/index.vue
  4. 449 0
      src/views/auxiliaryFittings/GoodsTransferPeceipt/index.vue
  5. 543 0
      src/views/auxiliaryFittings/GoodsTransferPeceipt/storage_goods.js
  6. 42 0
      src/views/auxiliaryFittings/GoodsTransferPeceipt/storage_table.js
  7. 394 345
      src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryChargeManagement/index.vue
  8. 198 137
      src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryMaterialClass/index.vue
  9. 313 263
      src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryPriceManagement/index.vue
  10. 1 1
      src/views/auxiliaryFittings/purchasingManagement/auxiliaryMaterialsStorage/index.vue
  11. 49 28
      src/views/salesPurchasing/goodsPurchasedStored/index.vue
  12. 76 59
      src/views/salesPurchasing/mixins/common_code.js
  13. 96 67
      src/views/salesPurchasing/mixins/common_form.js
  14. 84 65
      src/views/salesPurchasing/mixins/storage_goods.js
  15. 33 12
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/index.vue
  16. 152 122
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/basicInfo.js
  17. 48 38
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/dispatchInfo.js
  18. 108 90
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/pandanxinxi.js
  19. 303 190
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/productColumns.js
  20. 30 16
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js
  21. 316 200
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/wb_productColumns.js
  22. 70 70
      src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/workOrderLogic.js

+ 57 - 0
src/api/AuxiliaryAccessoriesWarehouse.js

@@ -0,0 +1,57 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function websitGoodsMoveList(data) {
+  return request({
+    url: `/websit/goods/move/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsMoveListExport(data, name) {
+  return postBlob({
+    url: '/websit/goods/move/list/export',
+    data,
+    name
+  })
+}
+
+export function websitGoodsMoveAdd(data) {
+  return request({
+    url: `/websit/goods/move/add`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsMoveSubmit(data) {
+  return request({
+    url: `/websit/goods/move/submit`,
+    method: 'post',
+    data
+  })
+}
+
+export function websitGoodsMoveDetail(params) {
+  return request({
+    url: '/websit/goods/move/detail',
+    method: 'post',
+    params
+  })
+}
+
+export function websitGoodsMoveConfirm(params) {
+  return request({
+    url: '/websit/goods/move/confirm',
+    method: 'post',
+    params
+  })
+}
+
+export function websitGoodsMoveDel(params) {
+  return request({
+    url: '/websit/goods/move/del',
+    method: 'post',
+    params
+  })
+}

+ 109 - 0
src/api/GoodsTransferPeceipt.js

@@ -0,0 +1,109 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function goodsMoveList(data) {
+  return request({
+    url: `/goods/move/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsMoveListExport(data, name) {
+  return postBlob({
+    url: '/goods/move/list/export',
+    data,
+    name
+  })
+}
+
+export function goodsMoveItemImportCode(data) {
+  return handleImport('/goods/move/item/import/code', data.formdata, data.id || '')
+}
+
+export function goodsMoveAdd(data) {
+  return request({
+    url: `/goods/move/add`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsMoveSubmit(params) {
+  return request({
+    url: `/goods/move/submit`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveDetail(params) {
+  return request({
+    url: '/goods/move/detail',
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveConfirm(params) {
+  return request({
+    url: '/goods/move/confirm',
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveUpdate(data) {
+  return request({
+    url: `/goods/move/update`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsMoveDel(params) {
+  return request({
+    url: '/goods/move/del',
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveItemAddCode(data) {
+  return request({
+    url: `/goods/move/item/add/code`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsMoveItemDelCode(params) {
+  return request({
+    url: `/goods/move/item/del/code`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveQueryExistStorageBrand(params) {
+  return request({
+    url: `/goods/move/query/exist/storage/brand`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveQueryExistStorageCategory(params) {
+  return request({
+    url: `/goods/move/query/exist/storage/category`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsMoveQueryExistStorageGoods(params) {
+  return request({
+    url: `/goods/move/query/exist/storage/goods`,
+    method: 'post',
+    params
+  })
+}

+ 218 - 0
src/views/auxiliaryFittings/AuxiliaryAccessoriesWarehouse/index.vue

@@ -0,0 +1,218 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+      >
+      </template-page>
+      <div v-if="~['add', 'examine', 'detail'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="100px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button v-if="formDialogType !== 2" size="mini" @click="formConfirm(data.removeTab)" type="primary"
+            >确 定</el-button
+          >
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {
+  websitGoodsMoveList,
+  websitGoodsMoveListExport,
+  websitGoodsMoveAdd,
+  websitGoodsMoveDetail,
+  websitGoodsMoveConfirm,
+  websitGoodsMoveSubmit,
+  websitGoodsMoveDel
+} from '@/api/AuxiliaryAccessoriesWarehouse'
+
+import ImageUpload from '@/components/file-upload'
+import operation_mixin from '@/components/template/operation_mixin.js'
+export default {
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin, operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '审核', '查看'],
+      formDialog: false,
+      formData: {
+        chargingStandardTypeId: '',
+        brandId: '',
+        oneCategoryId: '',
+        twoCategoryId: '',
+        status: true
+      },
+      businessTypeList: [], // 业务类型列表
+      brandList: [], // 品牌列表
+      mainList: [], // 一级分类列表
+      smallList: [], // 二级分类列表
+      formVisible: false
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return []
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: websitGoodsMoveList,
+    // 列表导出函数
+    exportList: websitGoodsMoveListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    // 表格操作列
+    operation() {
+      return this.operationBtn({
+        view: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('detail', row.id)
+          }
+        },
+        examine: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('examine', row.id)
+          }
+        }
+      })
+    },
+    // 取消 新增编辑
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+    },
+    // 打开 新增编辑 网点表单
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: 'examine', add: '新增', detail: '查看' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formVisible = true
+            if (type == 'add') {
+              this.formDialogType = 0
+              this.initData()
+            } else if (type == 'examine') {
+              this.formDialogType = 1
+              websitGoodsMoveDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+                this.initData()
+              })
+            } else {
+              this.formDialogType = 2
+              websitGoodsMoveDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+                this.initData()
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {}
+      })
+    },
+    initData() {
+      // Promise.all([
+      // ]).then(([res1, res2, res3]) => {
+      // })
+    },
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          if (this.formDialogType == 0) {
+            websitGoodsMoveAdd({ ...this.formData }).then(res => {
+              this.$message({
+                type: 'success',
+                message: this.formDialogTitles[this.formDialogType] + `成功!`
+              })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          } else if (this.formDialogType == 1) {
+            websitGoodsMoveConfirm({ ...this.formData }).then(res => {
+              this.$message({
+                type: 'success',
+                message: this.formDialogTitles[this.formDialogType] + `成功!`
+              })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 449 - 0
src/views/auxiliaryFittings/GoodsTransferPeceipt/index.vue

@@ -0,0 +1,449 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+      >
+      </template-page>
+      <div v-if="~['add', 'examine', 'detail'].indexOf(activeKey)">
+        <div style="box-sizing: border-box; padding: 20px">
+          <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+            <zj-form-module
+              title="单据信息"
+              label-width="100px"
+              :showPackUp="false"
+              :form-data="formData"
+              :form-items="formItems"
+            >
+            </zj-form-module>
+            <zj-form-module
+              title="产品信息"
+              label-width="100px"
+              :showPackUp="false"
+              :form-data="formData"
+              :form-items="formItems2"
+            >
+            </zj-form-module>
+          </zj-form-container>
+          <div slot="footer" class="dialog-footer">
+            <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+            <el-button v-if="formDialogType !== 2" size="mini" @click="formSubmit(data.removeTab)" type="primary"
+              >保 存</el-button
+            >
+            <el-button v-if="formDialogType == 1" size="mini" @click="formConfirm(data.removeTab)" type="primary"
+              >审 核</el-button
+            >
+          </div>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {
+  goodsMoveList,
+  goodsMoveListExport,
+  goodsMoveAdd,
+  goodsMoveDetail,
+  goodsMoveConfirm,
+  goodsMoveSubmit,
+  goodsMoveUpdate,
+  goodsMoveItemImportCode,
+  goodsMoveDel,
+  goodsMoveItemAddCode,
+  goodsMoveItemDelCode,
+  goodsMoveQueryExistStorageBrand,
+  goodsMoveQueryExistStorageCategory,
+  goodsMoveQueryExistStorageGoods
+} from '@/api/GoodsTransferPeceipt'
+import ImageUpload from '@/components/file-upload'
+import operation_mixin from '@/components/template/operation_mixin.js'
+import editTable from '@/components/template/editTable.js'
+import { getWebsit } from '@/api/customerManagement.js'
+import { storageListPageV2 } from '@/api/storage'
+import { materialCategoryList } from '@/api/auxiliaryMaterialClass'
+import storage_goods from './storage_goods.js'
+import storage_table from './storage_table.js'
+export default {
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin, operation_mixin, storage_goods, storage_table],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '审核', '查看'],
+      formData: {
+        companyWechatId: '',
+        companyWechatName: '',
+        examineBy: '',
+        examineTime: '',
+        inStorageId: '',
+        inStorageName: '',
+        items: [],
+        outStorageId: '',
+        outStorageName: '',
+        remark: '',
+        status: '',
+        submitBy: '',
+        submitTime: '',
+        totalQty: '',
+        type: 'G',
+        websitId: '',
+        websitName: ''
+      },
+      websitSelectList: [],
+      warehouseList: []
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: [
+            { label: '保存', value: 'SAVE' },
+            { label: '待审核', value: 'WAIT' },
+            { label: '通过', value: 'OK' },
+            { label: '失败', value: 'FAIL' }
+          ],
+          attributes: { disabled: true },
+          formItemAttributes: {
+            label: '单据状态',
+            prop: 'status',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '', disabled: true },
+          formItemAttributes: {
+            label: '单据编号',
+            prop: 'id',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: []
+          }
+        },
+        // {
+        //   md: 6,
+        //   isShow: true,
+        //   name: 'el-select',
+        //   options: this.websitSelectList.map(item => ({ label: item.name, value: item.websitId })),
+        //   attributes: {},
+        //   formItemAttributes: {
+        //     label: '网点名称',
+        //     prop: 'websitId',
+        //     rules: [...required]
+        //   }
+        // },
+        {
+          md: 6,
+          name: 'el-radio',
+          options: [
+            { label: '商品', value: 'G' }
+            // { label: '辅材', value: 'M' },
+            // { label: '辅材', value: 'P' }
+          ],
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调仓产品',
+            prop: 'type',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: this.warehouseList
+            .map(item => ({ label: item.storageName, value: item.storageId }))
+            .filter(item => item.value !== this.formData.inStorageId),
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调出仓库',
+            prop: 'outStorageId',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: this.warehouseList
+            .map(item => ({ label: item.storageName, value: item.storageId }))
+            .filter(item => item.value !== this.formData.outStorageId),
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调入仓库',
+            prop: 'inStorageId',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'slot-component',
+          attributes: { placeholder: '' },
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            return <div></div>
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '制单人',
+            prop: 'createBy',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '制单时间',
+            prop: 'createTime',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '审核人',
+            prop: 'examineBy',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '审核时间',
+            prop: 'examineTime',
+            rules: []
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea', rows: 5, disabled: this.formDialogType == 2 },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: goodsMoveList,
+    // 列表导出函数
+    exportList: goodsMoveListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    // 表格操作列
+    operation() {
+      return this.operationBtn({
+        view: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('detail', row.id)
+          }
+        },
+        examine: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('examine', row.id)
+          }
+        }
+      })
+    },
+    // 取消 新增编辑
+    formCancel() {
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+    },
+    // 打开 新增编辑 网点表单
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { examine: '审核', add: '新增', detail: '查看' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            if (type == 'add') {
+              this.formDialogType = 0
+              this.initData()
+            } else if (type == 'examine') {
+              this.formDialogType = 1
+              goodsMoveDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+                this.initData()
+              })
+            } else {
+              this.formDialogType = 2
+              goodsMoveDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+                this.initData()
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {}
+      })
+    },
+    initData() {
+      this.getBaseList()
+      Promise.all([
+        getWebsit({ type: 'C', status: true }),
+        storageListPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.type', compare: 'like', value: '商品' },
+            { param: 'a.status', compare: '=', value: 'true' }
+          ]
+        })
+      ]).then(([res1, res2]) => {
+        this.websitSelectList = res1.data
+        this.warehouseList = res2.data.records
+      })
+    },
+    formSubmit(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          if (this.formDialogType == 0) {
+            goodsMoveAdd({ ...this.formData }).then(res => {
+              this.$message({
+                type: 'success',
+                message: `保存成功!`
+              })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          } else if (this.formDialogType == 1) {
+            goodsMoveUpdate({ ...this.formData }).then(res => {
+              this.$message({
+                type: 'success',
+                message: `保存成功!`
+              })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        }
+      })
+    },
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          goodsMoveUpdate({ ...this.formData }).then(res => {
+            goodsMoveSubmit({ id: this.formData.id }).then(res => {
+              goodsMoveConfirm({ id: this.formData.id, statusEnum: 'OK' }).then(res => {
+                this.$message({
+                  type: 'success',
+                  message: `审核成功!`
+                })
+                cancel('list')
+                this.$refs.pageRef.refreshList()
+              })
+            })
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 543 - 0
src/views/auxiliaryFittings/GoodsTransferPeceipt/storage_goods.js

@@ -0,0 +1,543 @@
+import { required, diyRequired } from '@/components/template/rules_verify.js'
+import { getBrandList } from '@/api/miniapp'
+import { getClassifyList } from '@/api/goods'
+import { goodsMaterialList } from '@/api/commercialMaterial.js'
+import { goodsPurchaseItemImportCode, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import { goodsMaterialDetail } from '@/api/commercialMaterial.js'
+export default {
+  data() {
+    return {
+      brandList: [],
+      ClassifyList: [],
+      goodsMaterialList: [],
+      isEditIndex: -1
+    }
+  },
+  computed: {
+    storage_goods() {
+      return [
+        {
+          columnAttributes: {
+            label: '*品牌',
+            prop: 'brandId',
+            propName: 'brandName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 0)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.brandList.find(item => item.id == val).brandName
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.brandList.map((item, index_) => (
+                      <el-option key={index_} label={item.brandName} value={item.id}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '*商品大类',
+            prop: 'mainId',
+            propName: 'mainName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 1)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.ClassifyList.find(
+                          item => item.categoryId == val
+                        ).name
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.ClassifyList.map((item, index_) => (
+                      <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '*商品小类',
+            prop: 'smallId',
+            propName: 'smallName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 2)
+                      if (val) {
+                        row[column.columnAttributes.propName] = (
+                          this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []
+                        ).find(item => item.categoryId == val).name
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {(this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []).map(
+                      (item, index_) => (
+                        <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                      )
+                    )}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '*商品名称',
+            prop: 'goodsMaterialId',
+            propName: 'goodsMaterialName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 3)
+                      if (val) {
+                        var data = this.goodsMaterialList
+                          .filter(
+                            item =>
+                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                          )
+                          .find(item => item.id == val)
+                        row[column.columnAttributes.propName] = data?.goodsName
+                        this.getGoodsDetl(data, res => {
+                          if (!!~[0, 1].indexOf(this.formDialogType)) {
+                            row['specsName'] = res?.specsName
+                            row['unit'] = res?.unit
+                            row['insideQty'] =
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                            row['outQty'] =
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                            row['partsQty'] =
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                          }
+                        })
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                        row['specsName'] = ''
+                        row['unit'] = ''
+                        row['insideQty'] = ''
+                        row['outQty'] = ''
+                        row['partsQty'] = ''
+                      }
+                    }}
+                    filterable={true}
+                    placeholder="请选择"
+                  >
+                    {this.goodsMaterialList
+                      .filter(
+                        item =>
+                          item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                      )
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.goodsName} value={item.id}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specsName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单位',
+            prop: 'unit'
+          },
+          render: (h, { row, column, index }) => {
+            return <div style="padding:0 6px">{{ C: '整套', I: '单个' }[row[column.columnAttributes.prop]] || ''}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '*数量',
+            prop: 'qty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val <= 0 ? 0 : Number(val)
+                      this.getGoodsDetl(
+                        this.goodsMaterialList
+                          .filter(
+                            item =>
+                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                          )
+                          .find(item => item.id == row.goodsMaterialId),
+                        res => {
+                          if (!!~[0, 1].indexOf(this.formDialogType)) {
+                            row['insideQty'] =
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                            row['outQty'] =
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                            row['partsQty'] =
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                          }
+                        }
+                      )
+                    }}
+                    type="number"
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '内机数量',
+            prop: 'insideQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '外机数量',
+            prop: 'outQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '配件数量',
+            prop: 'partsQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '调出库存数量',
+            prop: 'qty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '调入库存数量',
+            prop: 'qty'
+          }
+        },
+        ...(() => {
+          if (this.formDialogType < 2) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {[
+                        this.isEditIndex == index ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              console.log(this.getVfyKey(this.isEditIndex))
+                              this.$refs.formRef.validateField(
+                                this.getVfyKey(this.isEditIndex),
+                                (valid, invalidFields, errLabels) => {
+                                  if (valid && this.eidtItems()) {
+                                    this.isEditIndex = -1
+                                  }
+                                }
+                              )
+                            }}
+                          >
+                            保存
+                          </el-button>
+                        ) : null,
+                        this.isEditIndex == -1 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.isEditIndex = index
+                            }}
+                          >
+                            编辑
+                          </el-button>
+                        ) : null,
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.delGoodsInfo(row, index)
+                          }}
+                        >
+                          删除
+                        </el-button>
+                      ]}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {
+    // 获取商品详情
+    getGoodsDetl(row, cb, key = 'id') {
+      if (!row?.details?.id) {
+        goodsMaterialDetail({ id: row[key] }).then(res => {
+          Object.assign(row.details, res.data || {})
+          cb(row.details)
+        })
+      } else {
+        cb(row.details)
+      }
+    },
+    getBaseList() {
+      getBrandList({
+        status: true
+      }).then(res => {
+        this.brandList = res.data
+      })
+      getClassifyList({
+        type: 2,
+        status: true
+      }).then(res => {
+        this.ClassifyList = res.data
+      })
+      goodsMaterialList({
+        pageNum: 1,
+        pageSize: -1,
+        params: []
+      }).then(res => {
+        this.goodsMaterialList = res.data.records
+          .filter(item => item.isVirtyual !== 'YES' && item.state == 'ON')
+          .map(item => ({ ...item, details: {} }))
+      })
+    },
+    shanchujichu(row, num) {
+      if (num <= 0) {
+      }
+      if (num <= 1) {
+        row.smallId = ''
+        row.smallName = ''
+      }
+      if (num <= 2) {
+        row.goodsMaterialId = ''
+        row.goodsMaterialName = ''
+        row.specsName = ''
+        row.unit = ''
+        row.insideQty = ''
+        row.outQty = ''
+        row.partsQty = ''
+      }
+    },
+    getVfyKey(index, bool = true) {
+      return [
+        ...(() => {
+          if (bool) {
+            return [`items`]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (index > -1) {
+            return [
+              `items.${index}.brandId`,
+              `items.${index}.mainId`,
+              `items.${index}.smallId`,
+              `items.${index}.goodsMaterialId`,
+              `items.${index}.qty`
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    eidtItems() {
+      try {
+        this.formData.items.map((item, index) => {
+          this.formData.items.map((item2, index2) => {
+            if (
+              index !== index2 &&
+              `${item.brandId}_${item.mainId}_${item.smallId}_${item.goodsMaterialId}` ==
+                `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}`
+            ) {
+              throw new Error('')
+            }
+          })
+        })
+      } catch (error) {
+        this.$message.warning('重复')
+        return false
+      }
+      return true
+    },
+    // 添加商品信息
+    addGoodsInfo() {
+      if (this.isEditIndex > -1) {
+        this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
+          if (valid && this.eidtItems()) {
+            this.formData.items.unshift({
+              brandId: '',
+              brandName: '',
+              mainId: '',
+              mainName: '',
+              smallId: '',
+              smallName: '',
+              goodsMaterialId: '',
+              goodsMaterialName: '',
+              specsName: '',
+              unit: '',
+              qty: '',
+              insideQty: '',
+              outQty: '',
+              partsQty: ''
+            })
+            this.isEditIndex = 0
+          }
+        })
+      } else if (this.eidtItems()) {
+        this.formData.items.unshift({
+          brandId: '',
+          brandName: '',
+          mainId: '',
+          mainName: '',
+          smallId: '',
+          smallName: '',
+          goodsMaterialId: '',
+          goodsMaterialName: '',
+          specsName: '',
+          unit: '',
+          qty: '',
+          insideQty: '',
+          outQty: '',
+          partsQty: ''
+        })
+        this.isEditIndex = 0
+      }
+    },
+    delGoodsInfo(row, index) {
+      if (index > this.isEditIndex) {
+        this.formData?.items?.splice(index, 1)
+      } else if (index == this.isEditIndex) {
+        this.formData?.items?.splice(index, 1)
+        this.isEditIndex = -1
+      }
+    }
+  }
+}

+ 42 - 0
src/views/auxiliaryFittings/GoodsTransferPeceipt/storage_table.js

@@ -0,0 +1,42 @@
+import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import { commonTemplateDownload } from '@/api/common.js'
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    formItems2() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <div>
+                {this.formDialogType < 2 ? (
+                  <el-button type="primary" onClick={this.addGoodsInfo}>
+                    添加
+                  </el-button>
+                ) : null}
+                <zj-table
+                  columns={this.storage_goods}
+                  tableData={this.formData.items}
+                  tableAttributes={{
+                    size: 'mini',
+                    border: true
+                  }}
+                />
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  }
+}

+ 394 - 345
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryChargeManagement/index.vue

@@ -1,32 +1,56 @@
 <template>
-	<zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
-		<template slot-scope="{activeKey, data}">
-			<template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-			  :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-			  :operation="operation()" :exportList="exportList" :operationColumnWidth="80">
-			</template-page>
-			<div v-if="~['add', 'edit'].indexOf(activeKey)">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-				  <zj-form-module title="" label-width="180px" :showPackUp="false"
-				    :form-data="formData" :form-items="formItems">
-				  </zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
-				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
-				</div>
-			</div>
-		</template>
-	</zj-tab-page>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+        :operationColumnWidth="80"
+      >
+      </template-page>
+      <div v-if="~['add', 'edit'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="180px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { materialNormList, materialNormListExport, materialNormAdd, materialNormEdit, materialNormDetail, materialNormBatchUpdateStatus, materialNormImport2, materialNormImport } from "@/api/auxiliaryChargeManagement";
-import { materialCategoryTree } from "@/api/auxiliaryMaterialClass";
-import { getTypeList } from "@/api/auxiliaryFittings/attachmentProfile";
+import {
+  materialNormList,
+  materialNormListExport,
+  materialNormAdd,
+  materialNormEdit,
+  materialNormDetail,
+  materialNormBatchUpdateStatus,
+  materialNormImport2,
+  materialNormImport
+} from '@/api/auxiliaryChargeManagement'
+import { materialCategoryTree } from '@/api/auxiliaryMaterialClass'
+import { getTypeList } from '@/api/auxiliaryFittings/attachmentProfile'
 import { commonTemplateDownload } from '@/api/common.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
@@ -34,47 +58,47 @@ export default {
   mixins: [import_mixin, operation_mixin],
   data() {
     return {
-		// 表格属性
-		tableAttributes: {
-			// 启用勾选列
-			selectColumn: true
-		},
-		// 表格事件
-		tableEvents: {
-			'selection-change': this.selectionChange
-		},
-		// 勾选选中行
-		recordSelected: [],
-		/** 表单变量 */
-		formDialogType: 0,
-		formDialogTitles: ["新增", "编辑"],
-		formDialog: false,
-		formData: {
-			companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
-			"categoryId": "",
-			"companyWechatId": "",
-			"createBy": "",
-			"createTime": "",
-			"normAmount": 0,
-			"normCode": "",
-			"normId": "",
-			"normName": "",
-			"normType": "",
-			"outWebsitAmount": 0,
-			"outWorkerAmount": 0,
-			"parentCategoryId": "",
-			"remark": "",
-			"selfWebsitAmount": 0,
-			"selfWorkerAmount": 0,
-			"specification": "",
-			"status": "ON",
-			"unit": "",
-			manualAmount: 0
-		},
-		partsUnitList: [],
-		materialCategoryTree: [],
-		formType: 'add',
-		formVisible: false,
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑'],
+      formDialog: false,
+      formData: {
+        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
+        categoryId: '',
+        companyWechatId: '',
+        createBy: '',
+        createTime: '',
+        normAmount: 0,
+        normCode: '',
+        normId: '',
+        normName: '',
+        normType: '',
+        outWebsitAmount: 0,
+        outWorkerAmount: 0,
+        parentCategoryId: '',
+        remark: '',
+        selfWebsitAmount: 0,
+        selfWorkerAmount: 0,
+        specification: '',
+        status: 'ON',
+        unit: '',
+        manualAmount: 0
+      },
+      partsUnitList: [],
+      materialCategoryTree: [],
+      formType: 'add',
+      formVisible: false
     }
   },
   computed: {
@@ -83,18 +107,18 @@ export default {
       return [
         [
           [
-            this.optionsEvensAuth("add", {
-				click: () => {
-					this.openForm('add')
-				}
-            }),
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
           ],
           [
-            this.optionsEvensAuth(["imp", "template"], {
+            this.optionsEvensAuth(['imp', 'template'], {
               name: '导入物料',
-              click: () => { }
+              click: () => {}
             }),
-            this.optionsEvensAuth("imp", ({ moduleName }) => {
+            this.optionsEvensAuth('imp', ({ moduleName }) => {
               return {
                 name: moduleName,
                 render: () => {
@@ -102,7 +126,7 @@ export default {
                 }
               }
             }),
-            this.optionsEvensAuth("template", {
+            this.optionsEvensAuth('template', {
               click: () => {
                 commonTemplateDownload({ name: '辅材收费标准模板(物料收费).xlsx' }, `辅材收费标准模板(物料收费)`)
                   .then(res => {
@@ -115,14 +139,14 @@ export default {
                     this.$message.error('下载失败')
                   })
               }
-            }),
+            })
           ],
           [
-            this.optionsEvensAuth(["Import", "downloadTemplate"], {
+            this.optionsEvensAuth(['Import', 'downloadTemplate'], {
               name: '导入服务',
-              click: () => { }
+              click: () => {}
             }),
-            this.optionsEvensAuth("Import", ({ moduleName }) => {
+            this.optionsEvensAuth('Import', ({ moduleName }) => {
               return {
                 name: moduleName,
                 render: () => {
@@ -130,7 +154,7 @@ export default {
                 }
               }
             }),
-            this.optionsEvensAuth("downloadTemplate", {
+            this.optionsEvensAuth('downloadTemplate', {
               click: () => {
                 commonTemplateDownload({ name: '辅材收费标准模板(服务收费).xlsx' }, `辅材收费标准模板(服务收费)`)
                   .then(res => {
@@ -143,37 +167,37 @@ export default {
                     this.$message.error('下载失败')
                   })
               }
-            }),
-          ],
+            })
+          ]
         ],
         [
           [
-            this.optionsEvensAuth("batchLaunch", {
+            this.optionsEvensAuth('batchLaunch', {
               click: () => {
                 if (this.recordSelected.length) {
-                  this.setRowStatus("ON")
+                  this.setRowStatus('ON')
                 } else {
                   this.$message({
                     type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
+                    message: `请先勾选需要设置的数据!`
+                  })
                 }
               }
-            }),
+            })
           ],
           [
-            this.optionsEvensAuth("batchRemoval", {
+            this.optionsEvensAuth('batchRemoval', {
               click: () => {
                 if (this.recordSelected.length) {
-                  this.setRowStatus("OFF")
+                  this.setRowStatus('OFF')
                 } else {
                   this.$message({
                     type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
+                    message: `请先勾选需要设置的数据!`
+                  })
                 }
               }
-            }),
+            })
           ]
         ]
       ]
@@ -183,236 +207,256 @@ export default {
       return []
     },
     formItems() {
-      return [{
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', disabled: true },
-        formItemAttributes: {
-          label: '所属商户',
-          prop: 'companyWechatName',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-radio',
-        options: [{ label: "上架", value: "ON" }, { label: "下架", value: "OFF" }],
-        attributes: {},
-        formItemAttributes: {
-          label: '状态',
-          prop: 'status',
-          rules: [...required]
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: [...required]
+          }
         },
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-cascader',
-        attributes: { style: "width:100%", placeholder: '请输入', options: this.materialCategoryTree, 'show-all-levels': false, props: { value: "categoryId", label: "categoryName", children: "child", emitPath: false }, clearable: true },
-        formItemAttributes: {
-          label: '选择分类',
-          prop: 'categoryId',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '辅材名称',
-          prop: 'normName',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-select-add',
-        labelKey: 'dictValue',
-        valueKey: 'dictValue',
-        options: this.partsUnitList,
-        attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
-        formItemAttributes: {
-          label: '单位',
-          prop: 'unit',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '商品代码',
-          prop: 'normCode',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '规格型号',
-          prop: 'specification',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-radio',
-        options: [{ label: "物料收费", value: "M" }, { label: "服务收费", value: "S" }],
-        attributes: {},
-        formItemAttributes: {
-          label: '收费类型',
-          prop: 'normType',
-          rules: [...required]
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '上架', value: 'ON' },
+            { label: '下架', value: 'OFF' }
+          ],
+          attributes: {},
+          formItemAttributes: {
+            label: '状态',
+            prop: 'status',
+            rules: [...required]
+          }
         },
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "number" },
-        formItemAttributes: {
-          label: '收费标准',
-          prop: 'normAmount',
-          rules: [...required]
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-cascader',
+          attributes: {
+            style: 'width:100%',
+            placeholder: '请输入',
+            options: this.materialCategoryTree,
+            'show-all-levels': false,
+            props: { value: 'categoryId', label: 'categoryName', children: 'child', emitPath: false },
+            clearable: true
+          },
+          formItemAttributes: {
+            label: '选择分类',
+            prop: 'categoryId',
+            rules: [...required]
+          }
         },
-        events: {
-          input: (val) => {
-            this.formData.selfWorkerAmount = ""
-            this.formData.outWorkerAmount = ""
-            this.$nextTick(() => {
-              this.formData.selfWebsitAmount = this.setNumber(
-                this.formData.normAmount - (this.formData.selfWorkerAmount || 0)
-              )
-              this.formData.outWebsitAmount = this.setNumber(
-                this.formData.normAmount - (this.formData.outWorkerAmount || 0)
-              )
-            })
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '辅材名称',
+            prop: 'normName',
+            rules: [...required]
           }
         },
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'slot-component',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '',
-          prop: '',
-          'label-width': "0px"
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select-add',
+          labelKey: 'dictValue',
+          valueKey: 'dictValue',
+          options: this.partsUnitList,
+          attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
+          formItemAttributes: {
+            label: '单位',
+            prop: 'unit',
+            rules: [...required]
+          }
         },
-        render: (h, { props, onInput }) => {
-          var { value } = props
-          return (
-            <div style="color:red">注:分账金额需扣除手续费0.6%</div>
-          )
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "number", disabled: !this.formData.normAmount, },
-        formItemAttributes: {
-          label: '自有库存师傅(分账金额)',
-          prop: 'selfWorkerAmount',
-          rules: [...required]
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '商品代码',
+            prop: 'normCode',
+            rules: []
+          }
         },
-        events: {
-          input: (val) => {
-            if (Number(val) > this.formData.normAmount) {
-              this.formData.selfWorkerAmount = this.setNumber(
-                this.formData.normAmount
-              )
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '规格型号',
+            prop: 'specification',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '物料收费', value: 'M' },
+            { label: '服务收费', value: 'S' }
+          ],
+          attributes: {},
+          formItemAttributes: {
+            label: '收费类型',
+            prop: 'normType',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '收费标准',
+            prop: 'normAmount',
+            rules: [...required]
+          },
+          events: {
+            input: val => {
+              this.formData.selfWorkerAmount = ''
+              this.formData.outWorkerAmount = ''
+              this.$nextTick(() => {
+                this.formData.selfWebsitAmount = this.setNumber(
+                  this.formData.normAmount - (this.formData.selfWorkerAmount || 0)
+                )
+                this.formData.outWebsitAmount = this.setNumber(
+                  this.formData.normAmount - (this.formData.outWorkerAmount || 0)
+                )
+              })
             }
-            this.formData.selfWebsitAmount = this.setNumber(
-              this.formData.normAmount - this.formData.selfWorkerAmount
-            )
           }
         },
-        slots: {
-          append: (h, { props, onInput }) => {
-            return <div>元</div>
+        {
+          md: 6,
+          isShow: true,
+          name: 'slot-component',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <div style="color:red">注:分账金额需扣除手续费0.6%</div>
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "number", disabled: !this.formData.normAmount, },
-        formItemAttributes: {
-          label: '外购辅材师傅(分账金额)',
-          prop: 'outWorkerAmount',
-          rules: [...required]
         },
-        events: {
-          input: (val) => {
-            if (Number(val) > this.formData.normAmount) {
-              this.formData.outWorkerAmount = this.setNumber(
-                this.formData.normAmount
-              )
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number', disabled: !this.formData.normAmount },
+          formItemAttributes: {
+            label: '自有库存师傅(分账金额)',
+            prop: 'selfWorkerAmount',
+            rules: [...required]
+          },
+          events: {
+            input: val => {
+              if (Number(val) > this.formData.normAmount) {
+                this.formData.selfWorkerAmount = this.setNumber(this.formData.normAmount)
+              }
+              this.formData.selfWebsitAmount = this.setNumber(this.formData.normAmount - this.formData.selfWorkerAmount)
+            }
+          },
+          slots: {
+            append: (h, { props, onInput }) => {
+              return <div>元</div>
             }
-            this.formData.outWebsitAmount = this.setNumber(
-              this.formData.normAmount - this.formData.outWorkerAmount
-            )
           }
         },
-        slots: {
-          append: (h, { props, onInput }) => {
-            return <div>元</div>
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number', disabled: !this.formData.normAmount },
+          formItemAttributes: {
+            label: '外购辅材师傅(分账金额)',
+            prop: 'outWorkerAmount',
+            rules: [...required]
+          },
+          events: {
+            input: val => {
+              if (Number(val) > this.formData.normAmount) {
+                this.formData.outWorkerAmount = this.setNumber(this.formData.normAmount)
+              }
+              this.formData.outWebsitAmount = this.setNumber(this.formData.normAmount - this.formData.outWorkerAmount)
+            }
+          },
+          slots: {
+            append: (h, { props, onInput }) => {
+              return <div>元</div>
+            }
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', disabled: true, type: "number", },
-        formItemAttributes: {
-          label: '自有库存商户(分账金额)',
-          prop: 'selfWebsitAmount',
-          rules: [...required]
         },
-        slots: {
-          append: (h, { props, onInput }) => {
-            return <div>元</div>
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true, type: 'number' },
+          formItemAttributes: {
+            label: '自有库存商户(分账金额)',
+            prop: 'selfWebsitAmount',
+            rules: [...required]
+          },
+          slots: {
+            append: (h, { props, onInput }) => {
+              return <div>元</div>
+            }
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', disabled: true, type: "number", },
-        formItemAttributes: {
-          label: '外购辅材商户(分账金额)',
-          prop: 'outWebsitAmount',
-          rules: [...required]
         },
-        slots: {
-          append: (h, { props, onInput }) => {
-            return <div>元</div>
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true, type: 'number' },
+          formItemAttributes: {
+            label: '外购辅材商户(分账金额)',
+            prop: 'outWebsitAmount',
+            rules: [...required]
+          },
+          slots: {
+            append: (h, { props, onInput }) => {
+              return <div>元</div>
+            }
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '师傅手工费用',
+            prop: 'manualAmount',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea', rows: 5 },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
           }
         }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: 'number' },
-        formItemAttributes: {
-          label: '师傅手工费用',
-          prop: 'manualAmount',
-          rules: [...required]
-        }
-      }, {
-        md: 24,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "textarea", rows: 5 },
-        formItemAttributes: {
-          label: '备注',
-          prop: 'remark',
-          rules: []
-        }
-      }]
+      ]
     }
   },
   methods: {
@@ -430,54 +474,59 @@ export default {
     },
 
     operation() {
-		return this.operationBtn({
-			edit: {
-				click: ({ row, index, column }) => {
-					this.openForm('edit',row.normId)
-				}
-			},
-		})
-    },
-    openForm() {
-      
+      return this.operationBtn({
+        edit: {
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.normId)
+          }
+        }
+      })
     },
+    openForm() {},
     openForm(type, id) {
-    	this.$refs.tabPage.addTab({
-    		// 对应显示的模块
-    		activeKey: type,
-    		// 唯一标识
-    		key: type,
-    		// 页签名称
-    		label: ({ edit: "编辑", add: "新增" })[type],
-    		// 打开时事件
-    		triggerEvent: () => {
-    			this.formCancel()
-    			this.$nextTick(()=>{
-    				this.formType = type
-    				this.formVisible = true
-    				Promise.all([
-    				  getTypeList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.dict_type", "compare": "=", "value": `ASSIST_UNIT` }, { "param": "a.status", "compare": "=", "value": "ON" }] }),
-    				  materialCategoryTree({ state: "ON" })
-    				]).then(([res1, res2]) => {
-    				  this.partsUnitList = res1.data.records
-    				  this.materialCategoryTree = res2.data.filter(item => (item.child && item.child.length > 0))
-    				  this.formDialog = true;
-    				})
-    				if (type == 'add') {
-    					this.formDialogType = 0
-    				} else if(type == 'edit'){
-    					this.formDialogType = 1
-    					materialNormDetail({ id }).then(res => {
-    					  Object.assign(this.formData, res.data)
-    					})
-    				}
-    			})
-    		},
-    		// 关闭时事件
-    		closeEvent: () => {
-    			this.formCancel()
-    		}
-    	})
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: '编辑', add: '新增' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
+            Promise.all([
+              getTypeList({
+                pageNum: 1,
+                pageSize: -1,
+                params: [
+                  { param: 'a.dict_type', compare: '=', value: `ASSIST_UNIT` },
+                  { param: 'a.status', compare: '=', value: 'ON' }
+                ]
+              }),
+              materialCategoryTree({ state: 'ON' })
+            ]).then(([res1, res2]) => {
+              this.partsUnitList = res1.data.records
+              this.materialCategoryTree = res2.data.filter(item => item.child && item.child.length > 0)
+              this.formDialog = true
+            })
+            if (type == 'add') {
+              this.formDialogType = 0
+            } else if (type == 'edit') {
+              this.formDialogType = 1
+              materialNormDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {
+          this.formCancel()
+        }
+      })
     },
     formCancel() {
       this.formVisible = false
@@ -487,7 +536,7 @@ export default {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([materialNormAdd, materialNormEdit][this.formDialogType])(this.formData).then(res => {
+          ;[materialNormAdd, materialNormEdit][this.formDialogType](this.formData).then(res => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             cancel('list')
             this.$refs.pageRef.refreshList()

+ 198 - 137
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryMaterialClass/index.vue

@@ -1,78 +1,126 @@
 <template>
-	<zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
-		<template slot-scope="{activeKey, data}">
-			<div v-if="activeKey == 'list'" class="app-container">
-				<div class="mymain-container">
-				  <div class="btn-group clearfix">
-				    <div class="fl">
-				      <el-button v-if="$restrict('add')" size="small" type="primary" icon="el-icon-plus"
-				        @click="openForm('add1')">添加</el-button>
-				    </div>
-				  </div>
-				  <div class="table">
-				    <el-table :data="dataList" row-key="categoryId" border default-expand-all :tree-props="{ children: 'child' }">
-				      <el-table-column prop="categoryName" label="分类名称" min-width="150"></el-table-column>
-				      <el-table-column align="center" label="状态" class-name="status-col">
-				        <template slot-scope="scope">
-				          <el-tag :type="scope.row.status ? 'success' : 'danger'">{{ ({ ON: '启用', OFF: '禁用' })[scope.row.status]
-				          }}</el-tag>
-				        </template>
-				      </el-table-column>
-				      <el-table-column align="center" prop="sort" label="排序"></el-table-column>
-				      <el-table-column align="right" label="操作" width="120" fixed="right">
-				        <template slot-scope="scope">
-				          <el-button v-if="scope.row.parentCategoryId == 0 && $restrict('add')" type="primary" size="mini"
-				            icon="el-icon-plus" @click="openForm('add2',scope.row)"></el-button>
-				          <el-button v-if="$restrict('edit')" type="primary" size="mini" icon="el-icon-edit"
-				            @click="openForm(scope.row.parentCategoryId == 0?'edit1':'edit2',scope.row)"></el-button>
-				        </template>
-				      </el-table-column>
-				    </el-table>
-				  </div>
-				</div>
-			</div>
-			<div v-if="~['add1', 'add2', 'edit1', 'edit2'].indexOf(activeKey)">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-				  <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
-				    :form-data="formData" :form-items="formItems">
-				  </zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-				  <el-button size="mini" @click="formCancel;data.removeTab()">取 消</el-button>
-				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
-				</div>
-			</div>
-		</template>
-	</zj-tab-page>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <div v-if="activeKey == 'list'" class="app-container">
+        <div class="mymain-container">
+          <div class="btn-group clearfix">
+            <div class="fl">
+              <el-button
+                v-if="$restrict('add')"
+                size="small"
+                type="primary"
+                icon="el-icon-plus"
+                @click="openForm('add1')"
+                >添加</el-button
+              >
+            </div>
+          </div>
+          <div class="table">
+            <el-table
+              :data="dataList"
+              row-key="categoryId"
+              border
+              default-expand-all
+              :tree-props="{ children: 'child' }"
+            >
+              <el-table-column prop="categoryName" label="分类名称" min-width="150"></el-table-column>
+              <el-table-column align="center" label="状态" class-name="status-col">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.status ? 'success' : 'danger'">{{
+                    { ON: '启用', OFF: '禁用' }[scope.row.status]
+                  }}</el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="sort" label="排序"></el-table-column>
+              <el-table-column align="right" label="操作" width="120" fixed="right">
+                <template slot-scope="scope">
+                  <el-button
+                    v-if="scope.row.parentCategoryId == 0 && $restrict('add')"
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-plus"
+                    @click="openForm('add2', scope.row)"
+                  ></el-button>
+                  <el-button
+                    v-if="$restrict('edit')"
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-edit"
+                    @click="openForm(scope.row.parentCategoryId == 0 ? 'edit1' : 'edit2', scope.row)"
+                  ></el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </div>
+      </div>
+      <div v-if="~['add1', 'add2', 'edit1', 'edit2'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            :title="formDialogTitles[formDialogType]"
+            label-width="100px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button
+            size="mini"
+            @click="
+              formCancel
+              data.removeTab()
+            "
+            >取 消</el-button
+          >
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
 </template>
 
 <script>
 import { getToken } from '@/utils/auth'
-import { getClassifyList, addClassify, editClassify, deleteClassify, getClassifyDetail, getSmallType } from '@/api/goods'
-import { ORDER_MAIN_TYPE } from "@/utils/select_data";
-import { materialCategoryList, materialCategoryAdd, materialCategoryUpdate, materialCategoryTree } from "@/api/auxiliaryMaterialClass";
+import {
+  getClassifyList,
+  addClassify,
+  editClassify,
+  deleteClassify,
+  getClassifyDetail,
+  getSmallType
+} from '@/api/goods'
+import { ORDER_MAIN_TYPE } from '@/utils/select_data'
+import {
+  materialCategoryList,
+  materialCategoryAdd,
+  materialCategoryUpdate,
+  materialCategoryTree
+} from '@/api/auxiliaryMaterialClass'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
 export default {
   data() {
     return {
       dataList: [], // 列表数据
-      screenForm: { // 筛选表单数据
-        keyword: '', // 关键词
+      screenForm: {
+        // 筛选表单数据
+        keyword: '' // 关键词
       },
       formDialogType: 0,
-      formDialogTitles: ["新增", "编辑"],
+      formDialogTitles: ['新增', '编辑'],
       formDialog: false,
       formData: {
         companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
-        status: "ON",
-        parentCategoryId: "",
-        categoryName: "",
-        sort: "",
+        status: 'ON',
+        parentCategoryId: '',
+        categoryName: '',
+        sort: '',
         categoryLevel: 2
       },
       materialCategoryList: [],
-			formType: 'add',
-			formVisible: false,
+      formType: 'add',
+      formVisible: false
     }
   },
   computed: {
@@ -95,30 +143,34 @@ export default {
         },
         ...(() => {
           if (this.formData.categoryLevel == 2) {
-            return [{
-              md: 6,
-              isShow: true,
-              name: 'el-select',
-              options: [...this.materialCategoryList, { categoryName: "无", categoryId: "0" }],
-              labelKey: "categoryName",
-              valueKey: "categoryId",
-              attributes: { placeholder: '请输入', disabled: this.formDialogType != 0 },
-              formItemAttributes: {
-                label: '父级分类',
-                prop: 'parentCategoryId',
-                rules: []
-              },
-              events: {
-                change: (val) => {
-                  if (val && val != 0) {
-                    this.formData.parentCategoryName = this.materialCategoryList.find(item => item.categoryId == val).categoryName
-                  } else {
-                    this.formData.parentCategoryName = ""
+            return [
+              {
+                md: 6,
+                isShow: true,
+                name: 'el-select',
+                options: [...this.materialCategoryList, { categoryName: '无', categoryId: '0' }],
+                labelKey: 'categoryName',
+                valueKey: 'categoryId',
+                attributes: { placeholder: '请输入', disabled: this.formDialogType != 0 },
+                formItemAttributes: {
+                  label: '父级分类',
+                  prop: 'parentCategoryId',
+                  rules: []
+                },
+                events: {
+                  change: val => {
+                    if (val && val != 0) {
+                      this.formData.parentCategoryName = this.materialCategoryList.find(
+                        item => item.categoryId == val
+                      ).categoryName
+                    } else {
+                      this.formData.parentCategoryName = ''
+                    }
+                    console.log(val)
                   }
-                  console.log(val)
                 }
               }
-            }]
+            ]
           }
           return []
         })(),
@@ -132,18 +184,23 @@ export default {
             prop: 'categoryName',
             rules: [...required]
           }
-        }, {
+        },
+        {
           md: 6,
           isShow: true,
           name: 'el-radio',
-          options: [{ label: "启用", value: "ON" }, { label: "禁用", value: "OFF" }],
+          options: [
+            { label: '启用', value: 'ON' },
+            { label: '禁用', value: 'OFF' }
+          ],
           attributes: {},
           formItemAttributes: {
             label: '状态',
             prop: 'status',
             rules: [...required]
-          },
-        }, {
+          }
+        },
+        {
           md: 6,
           isShow: true,
           name: 'el-input',
@@ -153,61 +210,66 @@ export default {
             prop: 'sort',
             rules: []
           }
-        },
+        }
       ]
     }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
-
     getList() {
       materialCategoryTree().then(res => {
         this.dataList = res.data
       })
     },
-    openForm(type,row) {
-		this.$refs.tabPage.addTab({
-			// 对应显示的模块
-			activeKey: type,
-			// 唯一标识
-			key: type,
-			// 页签名称
-			label: ({ edit1: "编辑一级分类", add1: "添加一级分类", edit2: "编辑二级分类", add2: "添加二级分类" })[type],
-			// 打开时事件
-			triggerEvent: () => {
-				
-				this.$nextTick(()=>{
-					this.formType = type
-					this.formVisible = true
-					Promise.all([
-					  materialCategoryList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.category_level", "compare": "=", "value": "1" }] })
-					]).then(([res1]) => {
-					  this.materialCategoryList = res1.data.records
-					  this.formDialog = true;
-					})
-					if(type == 'add1'){
-						this.formDialogType = 0
-					}else if(type == 'add2'){
-						this.formDialogType = 0
-						Object.assign(this.formData, {
-						  parentCategoryId: row.categoryId
-						})
-					}else if(type == 'edit1'){
-						Object.assign(this.formData, row)
-						this.formDialogType = 1
-					}else if(type == 'edit2'){
-						Object.assign(this.formData, row)
-						this.formDialogType = 1
-					}
-				})
-			},
-			// 关闭时事件
-			closeEvent: () => {
-				this.formCancel()
-			}
-		})
+    openForm(type, row) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit1: '编辑一级分类', add1: '添加一级分类', edit2: '编辑二级分类', add2: '添加二级分类' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
+            Promise.all([
+              materialCategoryList({
+                pageNum: 1,
+                pageSize: -1,
+                params: [
+                  { param: 'a.status', compare: '=', value: 'ON' },
+                  { param: 'a.category_level', compare: '=', value: '1' }
+                ]
+              })
+            ]).then(([res1]) => {
+              this.materialCategoryList = res1.data.records
+              this.formDialog = true
+            })
+            if (type == 'add1') {
+              this.formDialogType = 0
+            } else if (type == 'add2') {
+              this.formDialogType = 0
+              Object.assign(this.formData, {
+                parentCategoryId: row.categoryId
+              })
+            } else if (type == 'edit1') {
+              Object.assign(this.formData, row)
+              this.formDialogType = 1
+            } else if (type == 'edit2') {
+              Object.assign(this.formData, row)
+              this.formDialogType = 1
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {
+          this.formCancel()
+        }
+      })
     },
     formCancel() {
       this.formVisible = false
@@ -217,22 +279,21 @@ export default {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([materialCategoryAdd, materialCategoryUpdate][this.formDialogType])({
-            ...this.formData,
-            categoryLevel: !this.formData.parentCategoryId || this.formData.parentCategoryId == 0 ? 1 : 2
-          }).then(res => {
-            this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
-            cancel('list')
-            this.getList();
-          })
+          ;[materialCategoryAdd, materialCategoryUpdate]
+            [this.formDialogType]({
+              ...this.formData,
+              categoryLevel: !this.formData.parentCategoryId || this.formData.parentCategoryId == 0 ? 1 : 2
+            })
+            .then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.getList()
+            })
         }
       })
     }
-
   }
-
 }
-
 </script>
 
 <style scoped lang="scss"></style>

+ 313 - 263
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryPriceManagement/index.vue

@@ -1,32 +1,55 @@
 <template>
-	<zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
-		<template slot-scope="{activeKey, data}">
-			<template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-			  :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-			  :operation="operation()" :exportList="exportList" :operationColumnWidth="80">
-			</template-page>
-			<div v-if="~['add', 'edit'].indexOf(activeKey)">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-				  <zj-form-module title="" label-width="120px" :showPackUp="false"
-				    :form-data="formData" :form-items="formItems">
-				  </zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
-				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
-				</div>
-			</div>
-		</template>
-	</zj-tab-page>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operation="operation()"
+        :exportList="exportList"
+        :operationColumnWidth="80"
+      >
+      </template-page>
+      <div v-if="~['add', 'edit'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="120px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { websitGoodsmImport, materialNormList, materialNormListExport, materialNormAdd, materialNormEdit, materialNormDetail, materialNormBatchUpdateStatus } from "@/api/auxiliaryPriceManagement";
-import { materialCategoryTree } from "@/api/auxiliaryMaterialClass";
-import { getTypeList } from "@/api/auxiliaryFittings/attachmentProfile";
+import {
+  websitGoodsmImport,
+  materialNormList,
+  materialNormListExport,
+  materialNormAdd,
+  materialNormEdit,
+  materialNormDetail,
+  materialNormBatchUpdateStatus
+} from '@/api/auxiliaryPriceManagement'
+import { materialCategoryTree } from '@/api/auxiliaryMaterialClass'
+import { getTypeList } from '@/api/auxiliaryFittings/attachmentProfile'
 import { commonTemplateDownload } from '@/api/common.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
@@ -34,55 +57,55 @@ export default {
   mixins: [import_mixin, operation_mixin],
   data() {
     return {
-		// 表格属性
-		tableAttributes: {
-			// 启用勾选列
-			selectColumn: true
-		},
-		// 表格事件
-		tableEvents: {
-			'selection-change': this.selectionChange
-		},
-		// 勾选选中行
-		recordSelected: [],
-		/** 表单变量 */
-		formDialogType: 0,
-		formDialogTitles: ["新增", "编辑"],
-		formDialog: false,
-		formData: {
-			companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
-			"convertBitScale": "",
-			"cost": "",
-			"createBy": "",
-			"createTime": "",
-			"goodsBarcodeId": "",
-			"goodsCategoryId": "",
-			"goodsCode": "",
-			"goodsId": "",
-			"goodsImage": "",
-			"goodsName": "",
-			"goodsSalesConvertQty": "",
-			"goodsSalesUnit": "",
-			"goodsSpecification": "",
-			"goodsSpell": "",
-			"goodsStockUnit": "",
-			"goodsType": "M",
-			"manageWorkerStock": "",
-			"marketPrice": "",
-			"normAmount": "",
-			"normType": "",
-			"outWebsitAmount": "",
-			"outWorkerAmount": "",
-			"parentCategoryId": "",
-			"remark": "",
-			"selfWebsitAmount": "",
-			"selfWorkerAmount": "",
-			"status": "ON",
-		},
-		partsUnitList: [],
-		materialCategoryTree: [],
-		formType: 'add',
-		formVisible: false,
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑'],
+      formDialog: false,
+      formData: {
+        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
+        convertBitScale: '',
+        cost: '',
+        createBy: '',
+        createTime: '',
+        goodsBarcodeId: '',
+        goodsCategoryId: '',
+        goodsCode: '',
+        goodsId: '',
+        goodsImage: '',
+        goodsName: '',
+        goodsSalesConvertQty: '',
+        goodsSalesUnit: '',
+        goodsSpecification: '',
+        goodsSpell: '',
+        goodsStockUnit: '',
+        goodsType: 'M',
+        manageWorkerStock: '',
+        marketPrice: '',
+        normAmount: '',
+        normType: '',
+        outWebsitAmount: '',
+        outWorkerAmount: '',
+        parentCategoryId: '',
+        remark: '',
+        selfWebsitAmount: '',
+        selfWorkerAmount: '',
+        status: 'ON'
+      },
+      partsUnitList: [],
+      materialCategoryTree: [],
+      formType: 'add',
+      formVisible: false
     }
   },
   computed: {
@@ -91,18 +114,18 @@ export default {
       return [
         [
           [
-            this.optionsEvensAuth("add", {
-				click: () => {
-					this.openForm('add')
-				}
-            }),
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
           ],
           [
-            this.optionsEvensAuth(["imp", "template"], {
+            this.optionsEvensAuth(['imp', 'template'], {
               name: '导入辅材',
-              click: () => { }
+              click: () => {}
             }),
-            this.optionsEvensAuth("imp", ({ moduleName }) => {
+            this.optionsEvensAuth('imp', ({ moduleName }) => {
               return {
                 name: moduleName,
                 render: () => {
@@ -110,7 +133,7 @@ export default {
                 }
               }
             }),
-            this.optionsEvensAuth("template", {
+            this.optionsEvensAuth('template', {
               click: () => {
                 commonTemplateDownload({ name: '辅材模板.xlsx' }, `辅材模板`)
                   .then(res => {
@@ -123,37 +146,37 @@ export default {
                     this.$message.error('下载失败')
                   })
               }
-            }),
-          ],
+            })
+          ]
         ],
         [
           [
-            this.optionsEvensAuth("batchLaunch", {
+            this.optionsEvensAuth('batchLaunch', {
               click: () => {
                 if (this.recordSelected.length) {
-                  this.setRowStatus("ON")
+                  this.setRowStatus('ON')
                 } else {
                   this.$message({
                     type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
+                    message: `请先勾选需要设置的数据!`
+                  })
                 }
               }
-            }),
+            })
           ],
           [
-            this.optionsEvensAuth("batchRemoval", {
+            this.optionsEvensAuth('batchRemoval', {
               click: () => {
                 if (this.recordSelected.length) {
-                  this.setRowStatus("OFF")
+                  this.setRowStatus('OFF')
                 } else {
                   this.$message({
                     type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
+                    message: `请先勾选需要设置的数据!`
+                  })
                 }
               }
-            }),
+            })
           ]
         ]
       ]
@@ -163,137 +186,157 @@ export default {
       return []
     },
     formItems() {
-      return [{
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', disabled: true },
-        formItemAttributes: {
-          label: '所属商户',
-          prop: 'companyWechatName',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-radio',
-        options: [{ label: "上架", value: "ON" }, { label: "下架", value: "OFF" }],
-        attributes: {},
-        formItemAttributes: {
-          label: '状态',
-          prop: 'status',
-          rules: [...required]
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: [...required]
+          }
         },
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-cascader',
-        attributes: { style: "width:100%", placeholder: '请输入', options: this.materialCategoryTree, 'show-all-levels': false, props: { value: "categoryId", label: "categoryName", children: "child", emitPath: false }, clearable: true },
-        formItemAttributes: {
-          label: '选择分类',
-          prop: 'goodsCategoryId',
-          rules: [...required]
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { label: '上架', value: 'ON' },
+            { label: '下架', value: 'OFF' }
+          ],
+          attributes: {},
+          formItemAttributes: {
+            label: '状态',
+            prop: 'status',
+            rules: [...required]
+          }
         },
-        events: {
-          change: (val) => {
-            this.$refs.formRef.validateField(["goodsCategoryId"], (valid, invalidFields, errLabels) => { })
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-cascader',
+          attributes: {
+            style: 'width:100%',
+            placeholder: '请输入',
+            options: this.materialCategoryTree,
+            'show-all-levels': false,
+            props: { value: 'categoryId', label: 'categoryName', children: 'child', emitPath: false },
+            clearable: true
+          },
+          formItemAttributes: {
+            label: '选择分类',
+            prop: 'goodsCategoryId',
+            rules: [...required]
+          },
+          events: {
+            change: val => {
+              this.$refs.formRef.validateField(['goodsCategoryId'], (valid, invalidFields, errLabels) => {})
+            }
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '辅材名称',
-          prop: 'goodsName',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-select-add',
-        labelKey: 'dictValue',
-        valueKey: 'dictValue',
-        options: this.partsUnitList,
-        attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
-        formItemAttributes: {
-          label: '单位',
-          prop: 'goodsStockUnit',
-          rules: [...required]
         },
-        events: {
-          change: (val) => {
-            this.$refs.formRef.validateField(["goodsStockUnit"], (valid, invalidFields, errLabels) => { })
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '辅材名称',
+            prop: 'goodsName',
+            rules: [...required]
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '商品代码',
-          prop: 'goodsCode',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '规格型号',
-          prop: 'goodsSpecification',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "number" },
-        formItemAttributes: {
-          label: '采购价格',
-          prop: 'cost',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "number" },
-        formItemAttributes: {
-          label: '销售价格',
-          prop: 'marketPrice',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'slot-component',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '',
-          prop: '',
-          'label-width': "0px"
         },
-        render: (h, { props, onInput }) => {
-          var { value } = props
-          return (
-            <div style="color:red">注:销售价格即网点销售给师傅的辅材价格</div>
-          )
-        }
-      }, {
-        md: 24,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "textarea" },
-        formItemAttributes: {
-          label: '备注',
-          prop: 'remark',
-          rules: []
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select-add',
+          labelKey: 'dictValue',
+          valueKey: 'dictValue',
+          options: this.partsUnitList,
+          attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
+          formItemAttributes: {
+            label: '单位',
+            prop: 'goodsStockUnit',
+            rules: [...required]
+          },
+          events: {
+            change: val => {
+              this.$refs.formRef.validateField(['goodsStockUnit'], (valid, invalidFields, errLabels) => {})
+            }
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '商品代码',
+            prop: 'goodsCode',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '规格型号',
+            prop: 'goodsSpecification',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '采购价格',
+            prop: 'cost',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '销售价格',
+            prop: 'marketPrice',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'slot-component',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <div style="color:red">注:销售价格即网点销售给师傅的辅材价格</div>
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea' },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
+          }
         }
-      }]
+      ]
     }
   },
   methods: {
@@ -311,52 +354,59 @@ export default {
     },
 
     operation() {
-		return this.operationBtn({
-			edit: {
-				click: ({ row, index, column }) => {
-					this.openForm('edit',row.goodsId)
-				}
-			},
-		})
-	},
-	openForm(type, id) {
-		this.$refs.tabPage.addTab({
-			// 对应显示的模块
-			activeKey: type,
-			// 唯一标识
-			key: type,
-			// 页签名称
-			label: ({ edit: "编辑", add: "新增" })[type],
-			// 打开时事件
-			triggerEvent: () => {
-				this.formCancel()
-				this.$nextTick(()=>{
-					this.formType = type
-					this.formVisible = true
-					Promise.all([
-					  getTypeList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.dict_type", "compare": "=", "value": `ASSIST_UNIT` }, { "param": "a.status", "compare": "=", "value": "ON" }] }),
-					  materialCategoryTree({ state: "ON" })
-					]).then(([res1, res2]) => {
-					  this.partsUnitList = res1.data.records
-					  this.materialCategoryTree = res2.data.filter(item => (item.child && item.child.length > 0))
-					  this.formDialog = true;
-					})
-					if (type == 'add') {
-						this.formDialogType = 0
-					} else if(type == 'edit'){
-						this.formDialogType = 1
-						materialNormDetail({ id }).then(res => {
-						  Object.assign(this.formData, res.data)
-						})
-					}
-				})
-			},
-			// 关闭时事件
-			closeEvent: () => {
-				this.formCancel()
-			}
-		})
-	},
+      return this.operationBtn({
+        edit: {
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.goodsId)
+          }
+        }
+      })
+    },
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: '编辑', add: '新增' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
+            Promise.all([
+              getTypeList({
+                pageNum: 1,
+                pageSize: -1,
+                params: [
+                  { param: 'a.dict_type', compare: '=', value: `ASSIST_UNIT` },
+                  { param: 'a.status', compare: '=', value: 'ON' }
+                ]
+              }),
+              materialCategoryTree({ state: 'ON' })
+            ]).then(([res1, res2]) => {
+              this.partsUnitList = res1.data.records
+              this.materialCategoryTree = res2.data.filter(item => item.child && item.child.length > 0)
+              this.formDialog = true
+            })
+            if (type == 'add') {
+              this.formDialogType = 0
+            } else if (type == 'edit') {
+              this.formDialogType = 1
+              materialNormDetail({ id }).then(res => {
+                Object.assign(this.formData, res.data)
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {
+          this.formCancel()
+        }
+      })
+    },
     formCancel() {
       this.formVisible = false
       this.$refs?.formRef?.resetFields()
@@ -365,7 +415,7 @@ export default {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([materialNormAdd, materialNormEdit][this.formDialogType])({ ...this.formData, goodsType: "M" }).then(res => {
+          ;[materialNormAdd, materialNormEdit][this.formDialogType]({ ...this.formData, goodsType: 'M' }).then(res => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             cancel('list')
             this.$refs.pageRef.refreshList()

+ 1 - 1
src/views/auxiliaryFittings/purchasingManagement/auxiliaryMaterialsStorage/index.vue

@@ -3,7 +3,7 @@
 </template>
 
 <script>
-import InStorage from "../components/inStorage.vue"
+import InStorage from '../components/inStorage.vue'
 export default { components: { InStorage } }
 </script>
 

+ 49 - 28
src/views/salesPurchasing/goodsPurchasedStored/index.vue

@@ -1,7 +1,17 @@
 <template>
-  <template-page v-if="pageShow" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
-    :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
-    :column-parsing="columnParsing" :exportList="exportList" :operation="operation()" key="pageType">
+  <template-page
+    v-if="pageShow"
+    ref="pageRef"
+    :get-list="getList"
+    :table-attributes="tableAttributes"
+    :table-events="tableEvents"
+    :options-evens-group="optionsEvensGroup"
+    :moreParameters="moreParameters"
+    :column-parsing="columnParsing"
+    :exportList="exportList"
+    :operation="operation()"
+    key="pageType"
+  >
     <div slot="moreSearch">
       <el-radio-group v-model="pageType" size="mini" @input="changePageType">
         <el-radio-button label="list">列表</el-radio-button>
@@ -11,8 +21,13 @@
       <br /><br />
     </div>
     <div class="cartographer_big">
-      <el-dialog :title="formDialogTitles[formDialogType]" width="100%" :modal="false" :visible.sync="formDialog"
-        :before-close="handleClose">
+      <el-dialog
+        :title="formDialogTitles[formDialogType]"
+        width="100%"
+        :modal="false"
+        :visible.sync="formDialog"
+        :before-close="handleClose"
+      >
         <zj-page-container>
           <zj-page-fill>
             <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
@@ -32,7 +47,9 @@
             <el-button v-if="formDialogType == 0" size="mini" type="primary" @click="save">保存</el-button>
             <el-button v-if="formDialogType == 1" size="mini" type="primary" @click="submit">提交</el-button>
             <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('OK')">审核通过</el-button>
-            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('FAIL')">审核驳回</el-button>
+            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('FAIL')"
+              >审核驳回</el-button
+            >
           </div>
         </zj-page-container>
       </el-dialog>
@@ -62,7 +79,7 @@ import storage_table from '../mixins/storage_table'
 import storage_goods from '../mixins/storage_goods'
 import storage_codes from '../mixins/storage_codes'
 import common from '../mixins/common_code'
-import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from "js-perform-lock";
+import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from 'js-perform-lock'
 export default {
   components: { TemplatePage },
   mixins: [import_mixin, operation_mixin, form_ty, storage_table, storage_goods, storage_codes, common],
@@ -102,8 +119,8 @@ export default {
         updateTime: '',
         venderId: '',
         venderName: '',
-		storageId: '',
-		storageName: '',
+        storageId: '',
+        storageName: '',
         fileUrl: [],
         items: [],
         codeInfoList: []
@@ -111,8 +128,8 @@ export default {
       activeName: 'goodsInfo',
       goods_material_id: '',
       joinCode: false,
-	  joinCodeText: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
-      logs:[]
+      joinCodeText: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
+      logs: []
     }
   },
   computed: {
@@ -126,7 +143,7 @@ export default {
                 click: () => {
                   this.openForm()
                   this.formDialog = true
-                  this.joinCode = JSON.parse(localStorage.getItem('greemall_user')).joinCode === "CODE"
+                  this.joinCode = JSON.parse(localStorage.getItem('greemall_user')).joinCode === 'CODE'
                 }
               })
             ]
@@ -153,18 +170,22 @@ export default {
     }
   },
   methods: {
-    tishicuowu:(new delayPerform(500)).refactor(function( /**可接收参数**/ ){
-      if(this.logs){
-        var logs = Array.from(new Set(JSON.parse(JSON.stringify(this.logs)).map(item=>{
-          return `${item.index!==undefined ? "第" + (item.index+1) +"行:" : ""}${item.errMsg}`
-        })))
+    tishicuowu: new delayPerform(500).refactor(function (/**可接收参数**/) {
+      if (this.logs) {
+        var logs = Array.from(
+          new Set(
+            JSON.parse(JSON.stringify(this.logs)).map(item => {
+              return `${item.index !== undefined ? '第' + (item.index + 1) + '行:' : ''}${item.errMsg}`
+            })
+          )
+        )
         this.logs = []
         this.$message({
           dangerouslyUseHTMLString: true,
           type: 'warning',
-          message: logs.join("<div/>"),
-          duration: 5000,
-        });
+          message: logs.join('<div/>'),
+          duration: 5000
+        })
       }
     }),
     changePageType() {
@@ -209,7 +230,7 @@ export default {
     openForm() {
       this.isEditIndex = -1
       this.getGysList()
-	  this.getWarehouseList()
+      this.getWarehouseList()
       this.getBaseList()
     },
     // 打开详情弹窗
@@ -219,7 +240,7 @@ export default {
           fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
           items: res.data.items.map(item => ({ ...item, details: {} }))
         })
-        this.joinCode = res.data.joinCode === "CODE"
+        this.joinCode = res.data.joinCode === 'CODE'
         this.formDialogType = type
         this.openForm()
         this.formDialog = true
@@ -294,12 +315,12 @@ export default {
     save() {
       this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
         if (valid && this.eidtItems()) {
-			if(!this.formData.storageId && JSON.parse(localStorage.getItem('greemall_user')).joinCode != "NO"){
-				return this.$message({
-					type: 'warning',
-					message: '仓库不能为空'
-				})
-			}
+          if (!this.formData.storageId && JSON.parse(localStorage.getItem('greemall_user')).joinCode != 'NO') {
+            return this.$message({
+              type: 'warning',
+              message: '仓库不能为空'
+            })
+          }
           goodsPurchaseAdd({
             ...this.formData,
             items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),

+ 76 - 59
src/views/salesPurchasing/mixins/common_code.js

@@ -23,13 +23,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -74,13 +76,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -128,13 +132,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -184,13 +190,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -258,13 +266,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -311,13 +321,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -400,13 +412,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-input
                     value={row[column.columnAttributes.prop]}
@@ -435,13 +449,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-input
                     value={row[column.columnAttributes.prop]}
@@ -469,7 +485,8 @@ export default {
                 render: (h, { row, column, index }) => {
                   return (
                     <div style="padding:0 6px" class="operation-btns">
-                      {!!~[0,1].indexOf(this.formDialogType) ? [
+                      {!!~[0, 1].indexOf(this.formDialogType)
+                        ? [
                             this.isEditIndex == index ? (
                               <el-button
                                 type="text"
@@ -502,14 +519,14 @@ export default {
                                 编辑
                               </el-button>
                             ) : null,
-                           <el-button
+                            <el-button
                               type="text"
                               onClick={() => {
                                 this.delCode(row, index)
                               }}
                             >
                               删除
-                            </el-button>,
+                            </el-button>
                           ]
                         : null}
                     </div>

+ 96 - 67
src/views/salesPurchasing/mixins/common_form.js

@@ -7,7 +7,7 @@ export default {
   data() {
     return {
       gysList: [],
-	  warehouseList: [],
+      warehouseList: [],
       cgrkOrder: []
     }
   },
@@ -54,13 +54,20 @@ export default {
                 >
                   <el-descriptions-item label="*供应商名称">
                     <div class="redbordererr">
-                      <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={[diyRequired.bind(this)((rule, value)=>{
-                        if(this.logs){
-                          this.logs.push({errMsg:`*供应商名称不能为空`})
-                        }
-                        this?.tishicuowu?.()
-                        return new Error('必须填写')
-                      })]}>
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`venderId`}
+                        rules={[
+                          diyRequired.bind(this)((rule, value) => {
+                            if (this.logs) {
+                              this.logs.push({ errMsg: `*供应商名称不能为空` })
+                            }
+                            this?.tishicuowu?.()
+                            return new Error('必须填写')
+                          })
+                        ]}
+                      >
                         <el-select
                           style="width:100%"
                           value={this.formData.venderId}
@@ -90,42 +97,60 @@ export default {
                       </el-form-item>
                     </div>
                   </el-descriptions-item>
-					<el-descriptions-item label={(JSON.parse(localStorage.getItem('greemall_user')).joinCode === "NO"?'':'*') + (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ?'出库仓库':'入库仓库')}>
-					<div class="redbordererr">
-						<el-form-item label="" lebel-width="0px" prop={`storageId`}>
-						<el-select
-							style="width:100%"
-							value={this.formData.storageId}
-							onInput={val => {
-							this.formData.storageId = val
-							}}
-							placeholder="请选择"
-							disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) || !!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) || JSON.parse(localStorage.getItem('greemall_user')).joinCode === "NO"}
-							onChange={val => {
-								if (val) {
-									this.formData['storageName'] = this.warehouseList.find(item => item.storageId == val).storageName
-								} else {
-									this.formData['storageName'] = ''
-								}
-							}}
-						>
-							{this.warehouseList.map(item => (
-							<el-option key={item.storageId} label={item.storageName} value={item.storageId}></el-option>
-							))}
-						</el-select>
-						</el-form-item>
-					</div>
-					</el-descriptions-item>
+                  <el-descriptions-item
+                    label={
+                      (JSON.parse(localStorage.getItem('greemall_user')).joinCode === 'NO' ? '' : '*') +
+                      (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? '出库仓库' : '入库仓库')
+                    }
+                  >
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`storageId`}>
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.storageId}
+                          onInput={val => {
+                            this.formData.storageId = val
+                          }}
+                          placeholder="请选择"
+                          disabled={
+                            !!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) ||
+                            !!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ||
+                            JSON.parse(localStorage.getItem('greemall_user')).joinCode === 'NO'
+                          }
+                          onChange={val => {
+                            if (val) {
+                              this.formData['storageName'] = this.warehouseList.find(
+                                item => item.storageId == val
+                              ).storageName
+                            } else {
+                              this.formData['storageName'] = ''
+                            }
+                          }}
+                        >
+                          {this.warehouseList.map(item => (
+                            <el-option key={item.storageId} label={item.storageName} value={item.storageId}></el-option>
+                          ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
                   {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
                     <el-descriptions-item label="*采购入库单">
                       <div class="redbordererr">
-                        <el-form-item label="" lebel-width="0px" prop={`goodsPurchaseId`} rules={[diyRequired.bind(this)((rule, value)=>{
-                          if(this.logs){
-                            this.logs.push({errMsg:`*采购入库单不能为空`})
-                          }
-                          this?.tishicuowu?.()
-                          return new Error('必须填写')
-                        })]}>
+                        <el-form-item
+                          label=""
+                          lebel-width="0px"
+                          prop={`goodsPurchaseId`}
+                          rules={[
+                            diyRequired.bind(this)((rule, value) => {
+                              if (this.logs) {
+                                this.logs.push({ errMsg: `*采购入库单不能为空` })
+                              }
+                              this?.tishicuowu?.()
+                              return new Error('必须填写')
+                            })
+                          ]}
+                        >
                           <el-select
                             style="width:100%"
                             value={this.formData.goodsPurchaseId}
@@ -140,10 +165,10 @@ export default {
                               this.formData.items = []
                               if (val) {
                                 goodsPurchaseDetail({ id: val, isQuery: true }).then(res => {
-                                  this.joinCode = res.data.joinCode === "CODE"
-								  this.formData.storageId = res.data.storageId
-								  this.formData.storageName = res.data.storageName
-								  this.getWarehouseList(1)
+                                  this.joinCode = res.data.joinCode === 'CODE'
+                                  this.formData.storageId = res.data.storageId
+                                  this.formData.storageName = res.data.storageName
+                                  this.getWarehouseList(1)
                                   this.formData.items = res.data.items.map(item => ({
                                     brandId: item.brandId,
                                     brandName: item.brandName,
@@ -180,8 +205,9 @@ export default {
                             {this.cgrkOrder.map(item => (
                               <el-option
                                 key={item.id}
-                                label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${item.examineTime || '-'
-                                  }`}
+                                label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${
+                                  item.examineTime || '-'
+                                }`}
                                 value={item.id}
                               ></el-option>
                             ))}
@@ -204,11 +230,11 @@ export default {
                 >
                   {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)
                     ? [
-                      <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
-                      <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
-                      <el-descriptions-item label=""></el-descriptions-item>,
-                      <el-descriptions-item label=""></el-descriptions-item>
-                    ]
+                        <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
+                        <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
+                        <el-descriptions-item label=""></el-descriptions-item>,
+                        <el-descriptions-item label=""></el-descriptions-item>
+                      ]
                     : null}
                   <el-descriptions-item label="制单人">{this.formData.createBy}</el-descriptions-item>
                   <el-descriptions-item label="制单时间">{this.formData.createTime}</el-descriptions-item>
@@ -286,30 +312,33 @@ export default {
           pageSize: -1,
           params: [
             { param: 'a.vender_id', compare: '=', value: this.formData.venderId },
-            { "param": "a.status", "compare": "=", "value": "OK" }
+            { param: 'a.status', compare: '=', value: 'OK' }
           ]
         }).then(res => {
           this.cgrkOrder = res.data.records
           if (this.formData.goodsPurchaseId) {
             goodsPurchaseDetail({ id: this.formData.goodsPurchaseId, isQuery: true }).then(res => {
-              this.joinCode = res.data.joinCode === "CODE"
+              this.joinCode = res.data.joinCode === 'CODE'
             })
           }
         })
       }
     },
-	getWarehouseList(type){
-		storageListPageV2({
-          pageNum: 1,
-          pageSize: -1,
-          params: [{param: "a.type", compare: "like", value: "商品"},{param: "a.status", compare: "=", value: "true"}]
-        }).then(res => {
-			if(JSON.parse(localStorage.getItem('greemall_user')).joinCode != "NO" && !this.formData.storageId && type){
-				this.formData.storageId = res.data.records[0].storageId
-				this.formData.storageName = res.data.records[0].storageName
-			}
-          this.warehouseList = res.data.records
-        })
-	}
+    getWarehouseList(type) {
+      storageListPageV2({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          { param: 'a.type', compare: 'like', value: '商品' },
+          { param: 'a.status', compare: '=', value: 'true' }
+        ]
+      }).then(res => {
+        if (JSON.parse(localStorage.getItem('greemall_user')).joinCode != 'NO' && !this.formData.storageId && type) {
+          this.formData.storageId = res.data.records[0].storageId
+          this.formData.storageName = res.data.records[0].storageName
+        }
+        this.warehouseList = res.data.records
+      })
+    }
   }
 }

+ 84 - 65
src/views/salesPurchasing/mixins/storage_goods.js

@@ -29,13 +29,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -77,13 +79,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -127,13 +131,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -179,13 +185,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-select
                     value={row[column.columnAttributes.prop]}
@@ -203,7 +211,7 @@ export default {
                           .find(item => item.id == val)
                         row[column.columnAttributes.propName] = data?.goodsName
                         this.getGoodsDetl(data, res => {
-                          if (!!~[0,1].indexOf(this.formDialogType)) {
+                          if (!!~[0, 1].indexOf(this.formDialogType)) {
                             row['specsName'] = res?.specsName
                             row['unit'] = res?.unit
                             row['stockQty'] = res?.stockQty
@@ -291,13 +299,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-input
                     value={row[column.columnAttributes.prop]}
@@ -311,7 +321,7 @@ export default {
                           )
                           .find(item => item.id == row.goodsMaterialId),
                         res => {
-                          if (!!~[0,1].indexOf(this.formDialogType)) {
+                          if (!!~[0, 1].indexOf(this.formDialogType)) {
                             row['insideQty'] =
                               res.items
                                 .filter(item => item.type === 'INSIDE')
@@ -396,13 +406,15 @@ export default {
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-input
                     value={row[column.columnAttributes.prop]}
@@ -436,7 +448,6 @@ export default {
           }
         },
         ...(() => {
-
           if (this.formDialogType < 2 && !~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)) {
             return [
               {
@@ -466,7 +477,7 @@ export default {
                             保存
                           </el-button>
                         ) : null,
-                        this.isEditIndex == -1 && (this.joinCodeText != 'CODE' ||  this.formDialogType == 0) ? (
+                        this.isEditIndex == -1 && (this.joinCodeText != 'CODE' || this.formDialogType == 0) ? (
                           <el-button
                             type="text"
                             onClick={() => {
@@ -476,14 +487,16 @@ export default {
                             编辑
                           </el-button>
                         ) : null,
-						this.joinCodeText != 'CODE' || this.formDialogType == 0 ? (<el-button
-						   type="text"
-						   onClick={() => {
-						     this.delGoodsInfo(row, index)
-						   }}
-						 >
-						   删除
-						 </el-button>) : null,
+                        this.joinCodeText != 'CODE' || this.formDialogType == 0 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.delGoodsInfo(row, index)
+                            }}
+                          >
+                            删除
+                          </el-button>
+                        ) : null
                       ]}
                     </div>
                   )
@@ -501,17 +514,23 @@ export default {
                 render: (h, { row, column, index }) => {
                   return (
                     <div style="padding:0 6px" class="operation-btns">
-                      {this.importButton(goodsPurchaseItemImportCode, '导入条码', { purchaseItemId: row.id }, () => { }, () => {
-                        if (this.formData.id) {
-                          // 更新表单信息
-                          goodsPurchaseDetail({ id: this.formData.id }).then(res => {
-                            Object.assign(this.formData, res.data, {
-                              fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
-                              items: res.data.items.map(item => ({ ...item, details: {} }))
+                      {this.importButton(
+                        goodsPurchaseItemImportCode,
+                        '导入条码',
+                        { purchaseItemId: row.id },
+                        () => {},
+                        () => {
+                          if (this.formData.id) {
+                            // 更新表单信息
+                            goodsPurchaseDetail({ id: this.formData.id }).then(res => {
+                              Object.assign(this.formData, res.data, {
+                                fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
+                                items: res.data.items.map(item => ({ ...item, details: {} }))
+                              })
                             })
-                          })
+                          }
                         }
-                      })}
+                      )}
                     </div>
                   )
                 }
@@ -595,7 +614,7 @@ export default {
             if (
               index !== index2 &&
               `${item.brandId}_${item.mainId}_${item.smallId}_${item.goodsMaterialId}` ==
-              `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}`
+                `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}`
             ) {
               throw new Error('')
             }
@@ -633,7 +652,7 @@ export default {
               price: '',
               amount: '',
               stockQty: '',
-              factoryNo: "",
+              factoryNo: ''
             })
             this.isEditIndex = 0
           }

+ 33 - 12
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/index.vue

@@ -1,16 +1,24 @@
 <template>
   <zj-page-container v-if="orderInfo">
     <zj-page-fill class="neibuview">
-      <zj-form-container ref="formRef" :form-data="orderInfo" :form-rules="formRules" :form-attributes="{ size: 'mini' }">
+      <zj-form-container
+        ref="formRef"
+        :form-data="orderInfo"
+        :form-rules="formRules"
+        :form-attributes="{ size: 'mini' }"
+      >
         <!-- 派工信息 创建不需要 -->
         <zj-form-module v-if="id" title="派工信息" label-width="90px" :form-data="orderInfo" :form-items="dispatchInfo">
-          <div slot="internal-bottom" style="text-align: right;">
+          <div slot="internal-bottom" style="text-align: right">
             <copy-info text="复制工单信息" :info="dispatchInfo" :order-info="orderInfo" />
           </div>
           <div slot="right" style="width: 55%; position: relative">
             <div class="pgxxTable">
-              <zj-table :columns="logColumns" :table-data="logList"
-                :table-attributes="{ height: '100%', border: true }" />
+              <zj-table
+                :columns="logColumns"
+                :table-data="logList"
+                :table-attributes="{ height: '100%', border: true }"
+              />
             </div>
           </div>
         </zj-form-module>
@@ -19,7 +27,11 @@
         <!-- 服务信息 -->
         <zj-form-module title="服务信息" label-width="110px" :form-data="orderInfo" :form-items="serviceInfo" />
         <!-- 产品信息 -->
-        <zj-form-module title="产品信息" :form-data="orderInfo" :form-items="workOrderType == 4 ? product_wb : product" />
+        <zj-form-module
+          title="产品信息"
+          :form-data="orderInfo"
+          :form-items="workOrderType == 4 ? product_wb : product"
+        />
         <!-- 其它信息 -->
         <!-- <zj-form-module title="其它信息" :form-data="orderInfo" :form-items="otherInfo" /> -->
         <!-- 派单信息 -->
@@ -34,8 +46,12 @@
         <!-- 1,保存  -->
         <commitSave v-if="~btnRestrict.indexOf(1)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 2,过程反馈  -->
-        <processFeedback v-if="~btnRestrict.indexOf(2)" resultCodeName="过程反馈" :orderInfo="orderInfo"
-          :orderType="orderType" />
+        <processFeedback
+          v-if="~btnRestrict.indexOf(2)"
+          resultCodeName="过程反馈"
+          :orderInfo="orderInfo"
+          :orderType="orderType"
+        />
         <!-- 3,设为异常  -->
         <abnormal v-if="~btnRestrict.indexOf(3)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 4,加急  -->
@@ -45,14 +61,19 @@
         <!-- 6,取消工单  -->
         <cancelOrder v-if="~btnRestrict.indexOf(6)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 7,回访  -->
-        <processFeedback v-if="~btnRestrict.indexOf(7)" resultCodeName="回访" resultCode="回访" :orderInfo="orderInfo"
-          :orderType="orderType" />
+        <processFeedback
+          v-if="~btnRestrict.indexOf(7)"
+          resultCodeName="回访"
+          resultCode="回访"
+          :orderInfo="orderInfo"
+          :orderType="orderType"
+        />
         <!-- 8,新建工单 -->
         <!-- 9,工单驳回 -->
         <orderReject v-if="~btnRestrict.indexOf(9)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 10,激活工单 -->
         <activateOrder v-if="~btnRestrict.indexOf(10)" :orderInfo="orderInfo" :orderType="orderType" />
-        <cloneWorkOrderBtn :orderInfo="orderInfo" :orderType="orderType"/>
+        <cloneWorkOrderBtn :orderInfo="orderInfo" :orderType="orderType" />
       </div>
       <div style="box-sizing: border-box; padding: 10px 10px 0" v-else>
         <!-- 关闭 -->
@@ -129,11 +150,11 @@ export default {
   box-sizing: border-box;
   padding-left: 16px;
 
-  ::v-deep &>.zj-page-fill-scroll {
+  ::v-deep & > .zj-page-fill-scroll {
     box-sizing: border-box;
     padding-right: 16px;
 
-    &>div:nth-child(1) {
+    & > div:nth-child(1) {
       margin-top: 20px;
     }
   }

+ 152 - 122
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/basicInfo.js

@@ -1,6 +1,6 @@
 import { lbsAmapRegion } from '@/api/common.js'
-import { listPageV2, getDetail } from "@/api/engineeringMaintenance/basicData";
-import { orderEnginbaseList } from "@/api/basicEngineeringData";
+import { listPageV2, getDetail } from '@/api/engineeringMaintenance/basicData'
+import { orderEnginbaseList } from '@/api/basicEngineeringData'
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
 export default {
   data() {
@@ -14,41 +14,41 @@ export default {
     }
   },
   created() {
-    function getTimef(sfm = "00:00:00") {
-      var currentDate = new Date();
-      var year = currentDate.getFullYear();
-      var month = ('0' + (currentDate.getMonth() + 1)).slice(-2); // 月份从0开始,需要加1
-      var day = ('0' + currentDate.getDate()).slice(-2);
+    function getTimef(sfm = '00:00:00') {
+      var currentDate = new Date()
+      var year = currentDate.getFullYear()
+      var month = ('0' + (currentDate.getMonth() + 1)).slice(-2) // 月份从0开始,需要加1
+      var day = ('0' + currentDate.getDate()).slice(-2)
       return year + '-' + month + '-' + day + ' ' + sfm
     }
     // 获取工程下拉
     orderEnginbaseList({
-      "pageNum": 1,
-      "pageSize": -1,
-      "params": []
+      pageNum: 1,
+      pageSize: -1,
+      params: []
     }).then(res => {
       this.gc_project = res.data.records.map(item => {
         return {
           value: item.projectNo,
           label: item.projectName,
-          data: item,
+          data: item
         }
       })
     })
     // 获取维保下拉
     listPageV2({
-      "pageNum": 1,
-      "pageSize": -1,
-      "params": [
-        { "param": "a.start_time", "compare": "<=", "value": getTimef() },
-        { "param": "a.end_time", "compare": ">=", "value": getTimef() }
+      pageNum: 1,
+      pageSize: -1,
+      params: [
+        { param: 'a.start_time', compare: '<=', value: getTimef() },
+        { param: 'a.end_time', compare: '>=', value: getTimef() }
       ]
     }).then(res => {
       this.wb_project = res.data.records.map(item => {
         return {
           value: item.id,
           label: item.projectName,
-          data: item,
+          data: item
         }
       })
     })
@@ -59,106 +59,112 @@ export default {
       return [
         ...(() => {
           if (this.workOrderType == 4) {
-            return [{
-              isShow: this.formOptions.rpProjectRepairId.isShow,
-              name: 'el-select',
-              md: 12,
-              options: this.wb_project,
-              attributes: {
-                disabled: !this.formOptions.rpProjectRepairId.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '维保项目',
-                prop: 'rpProjectRepairId',
-                rules: this.formOptions.rpProjectRepairId.isRules
-              },
-              events: {
-                change: (val) => {
-                  this.getorderDetail(() => {
-                    if (val) {
-                      this.orderInfo.rpProjectRepairId = val
-                      this.orderInfo.rpProjectRepairName = this.wb_project.find(item => item.value == val).label
-                      this.getWeiBaoDetail()
-                    }
-                  })
+            return [
+              {
+                isShow: this.formOptions.rpProjectRepairId.isShow,
+                name: 'el-select',
+                md: 12,
+                options: this.wb_project,
+                attributes: {
+                  disabled: !this.formOptions.rpProjectRepairId.isEdit,
+                  placeholder: '请选择',
+                  clearable: true,
+                  filterable: true
+                },
+                formItemAttributes: {
+                  label: '维保项目',
+                  prop: 'rpProjectRepairId',
+                  rules: this.formOptions.rpProjectRepairId.isRules
+                },
+                events: {
+                  change: val => {
+                    this.getorderDetail(() => {
+                      if (val) {
+                        this.orderInfo.rpProjectRepairId = val
+                        this.orderInfo.rpProjectRepairName = this.wb_project.find(item => item.value == val).label
+                        this.getWeiBaoDetail()
+                      }
+                    })
+                  }
                 }
-              }
-            }, {
-              name: 'slot-component',
-              md: 12,
-              formItemAttributes: {
-                'label-width': '0px',
-                prop: '',
               },
-              render: (h, { props }) => {
-                return null
+              {
+                name: 'slot-component',
+                md: 12,
+                formItemAttributes: {
+                  'label-width': '0px',
+                  prop: ''
+                },
+                render: (h, { props }) => {
+                  return null
+                }
               }
-            },]
+            ]
           } else if (this.workOrderType == 2) {
-            return [{
-              isShow: this.formOptions.projectNo.isShow,
-              name: 'el-select',
-              md: 12,
-              options: this.gc_project,
-              attributes: {
-                disabled: !this.formOptions.projectNo.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '工程名称',
-                prop: 'projectNo',
-                rules: this.formOptions.projectNo.isRules
-              },
-              events: {
-                change: (val) => {
-                  this.getorderDetail(() => {
-                    if (val) {
-                      this.orderInfo.projectNo = val
-                      var item = this.gc_project.find(item => item.value == val)
-                      if (item) {
-                        this.orderInfo.projectName = item.label
-                        var data = item.data
-                        if (data) {
-                          this.orderInfo.userName = data.manger
-                          this.orderInfo.linkName = data.manger
-                          this.orderInfo.userMobile = data.mobile
-                          this.orderInfo.provinceId = data.provinceId
-                          this.orderInfo.province = data.province
-                          this.orderInfo.cityId = data.cityId
-                          this.orderInfo.city = data.city
-                          this.orderInfo.areaId = data.areaId
-                          this.orderInfo.area = data.area
-                          this.orderInfo.streetId = data.streetId
-                          this.orderInfo.street = data.street
-                          this.orderInfo.gpsAddress = data.gpsAddress || data.address
-                          this.orderInfo.lat = data.lat
-                          this.orderInfo.lng = data.lng
-                          this.orderInfo.address = data.address
-                          this.getinitlbslist()
+            return [
+              {
+                isShow: this.formOptions.projectNo.isShow,
+                name: 'el-select',
+                md: 12,
+                options: this.gc_project,
+                attributes: {
+                  disabled: !this.formOptions.projectNo.isEdit,
+                  placeholder: '请选择',
+                  clearable: true,
+                  filterable: true
+                },
+                formItemAttributes: {
+                  label: '工程名称',
+                  prop: 'projectNo',
+                  rules: this.formOptions.projectNo.isRules
+                },
+                events: {
+                  change: val => {
+                    this.getorderDetail(() => {
+                      if (val) {
+                        this.orderInfo.projectNo = val
+                        var item = this.gc_project.find(item => item.value == val)
+                        if (item) {
+                          this.orderInfo.projectName = item.label
+                          var data = item.data
+                          if (data) {
+                            this.orderInfo.userName = data.manger
+                            this.orderInfo.linkName = data.manger
+                            this.orderInfo.userMobile = data.mobile
+                            this.orderInfo.provinceId = data.provinceId
+                            this.orderInfo.province = data.province
+                            this.orderInfo.cityId = data.cityId
+                            this.orderInfo.city = data.city
+                            this.orderInfo.areaId = data.areaId
+                            this.orderInfo.area = data.area
+                            this.orderInfo.streetId = data.streetId
+                            this.orderInfo.street = data.street
+                            this.orderInfo.gpsAddress = data.gpsAddress || data.address
+                            this.orderInfo.lat = data.lat
+                            this.orderInfo.lng = data.lng
+                            this.orderInfo.address = data.address
+                            this.getinitlbslist()
+                          }
                         }
                       }
-                    }
-                  })
+                    })
+                  }
                 }
-              }
-            }, {
-              isShow: true,
-              name: 'el-input',
-              md: 12,
-              attributes: {
-                disabled: true,
               },
-              formItemAttributes: {
-                label: '工程编号',
-                prop: 'projectNo',
-                rules: this.formOptions.projectNo.isRules
+              {
+                isShow: true,
+                name: 'el-input',
+                md: 12,
+                attributes: {
+                  disabled: true
+                },
+                formItemAttributes: {
+                  label: '工程编号',
+                  prop: 'projectNo',
+                  rules: this.formOptions.projectNo.isRules
+                }
               }
-            }]
+            ]
           }
           return []
         })(),
@@ -173,10 +179,10 @@ export default {
             rules: this.formOptions.userName.isRules
           },
           events: {
-            input: (v) => {
+            input: v => {
               this.orderInfo.linkName = v
               if (v) {
-                this.appointVerify(["linkName"], () => { }, false)
+                this.appointVerify(['linkName'], () => {}, false)
               }
             }
           }
@@ -225,9 +231,14 @@ export default {
             errLabel: '省'
           },
           options: this.provinceList.map((v, i) => ({ value: v.id, label: v.name })),
-          attributes: { disabled: !this.formOptions.gpsAddress.isEdit, clearable: true, filterable: true, placeholder: '请选择' },
+          attributes: {
+            disabled: !this.formOptions.gpsAddress.isEdit,
+            clearable: true,
+            filterable: true,
+            placeholder: '请选择'
+          },
           events: {
-            change: (val) => {
+            change: val => {
               // 获取省名称
               this.orderInfo.province = this.provinceList.find(item => item.id === val)?.name || ''
               // 清除市区街道以及详细地址数据
@@ -250,9 +261,14 @@ export default {
             errLabel: '市'
           },
           options: this.cityList.map((v, i) => ({ value: v.id, label: v.name })),
-          attributes: { disabled: !this.formOptions.gpsAddress.isEdit, clearable: true, filterable: true, placeholder: '请选择' },
+          attributes: {
+            disabled: !this.formOptions.gpsAddress.isEdit,
+            clearable: true,
+            filterable: true,
+            placeholder: '请选择'
+          },
           events: {
-            change: (val) => {
+            change: val => {
               // 获取市名称
               this.orderInfo.city = this.cityList.find(item => item.id === val).name
               // 清除区街道以及详细地址数据
@@ -275,9 +291,14 @@ export default {
             errLabel: '区'
           },
           options: this.areaList.map((v, i) => ({ value: v.id, label: v.name })),
-          attributes: { disabled: !this.formOptions.gpsAddress.isEdit, clearable: true, filterable: true, placeholder: '请选择' },
+          attributes: {
+            disabled: !this.formOptions.gpsAddress.isEdit,
+            clearable: true,
+            filterable: true,
+            placeholder: '请选择'
+          },
           events: {
-            change: (val) => {
+            change: val => {
               // 获取区名称
               this.orderInfo.area = this.areaList.find(item => item.id === val).name
               // 清除街道以及详细地址数据
@@ -300,9 +321,14 @@ export default {
             errLabel: '街道'
           },
           options: this.streetList.map((v, i) => ({ value: v.id, label: v.name })),
-          attributes: { disabled: !this.formOptions.gpsAddress.isEdit, clearable: true, filterable: true, placeholder: '请选择' },
+          attributes: {
+            disabled: !this.formOptions.gpsAddress.isEdit,
+            clearable: true,
+            filterable: true,
+            placeholder: '请选择'
+          },
           events: {
-            change: (val) => {
+            change: val => {
               // 获取街道名称
               this.orderInfo.street = this.streetList.find(item => item.id === val).name
               // 清除详细地址数据
@@ -316,7 +342,7 @@ export default {
           md: 3,
           formItemAttributes: {
             'label-width': '0px',
-            prop: '',
+            prop: ''
           },
           render: (h, { props }) => {
             return (
@@ -381,7 +407,12 @@ export default {
           isShow: this.formOptions.address.isShow,
           name: 'el-input',
           md: 11,
-          formItemAttributes: { label: '', prop: 'address', 'label-width': '0px', rules: this.formOptions.address.isRules },
+          formItemAttributes: {
+            label: '',
+            prop: 'address',
+            'label-width': '0px',
+            rules: this.formOptions.address.isRules
+          },
           attributes: { disabled: !this.formOptions.address.isEdit, placeholder: '详细地址' }
         },
         {
@@ -409,7 +440,6 @@ export default {
         getDetail({
           id: this.orderInfo.rpProjectRepairId
         }).then(res => {
-
           if (!this.id) {
             this.orderInfo.userName = res.data.manger
             this.orderInfo.linkName = res.data.manger
@@ -444,7 +474,7 @@ export default {
           this.getWorkers()
 
           // 产品信息可选项
-          this.productList_wb = (res.data.productList || [])
+          this.productList_wb = res.data.productList || []
 
           this.getinitlbslist()
         })

+ 48 - 38
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/dispatchInfo.js

@@ -1,4 +1,4 @@
-import { orderBaseLogList } from "@/api/workOrderPool.js"
+import { orderBaseLogList } from '@/api/workOrderPool.js'
 import copyInfo from '../buttons/copyInfo.vue'
 import ImageUpload from '@/components/file-upload'
 export default {
@@ -27,9 +27,15 @@ export default {
             width: 150
           },
           render: (h, { row, column, index }) => {
-            return <div style="padding: 0 10px">
-              <ImageUpload fileList={row.imgSrc ? row.imgSrc.split(",").map(url => ({ url })) : []} limit={100} isEdit={false} />
-            </div>
+            return (
+              <div style="padding: 0 10px">
+                <ImageUpload
+                  fileList={row.imgSrc ? row.imgSrc.split(',').map(url => ({ url })) : []}
+                  limit={100}
+                  isEdit={false}
+                />
+              </div>
+            )
           }
         },
         {
@@ -59,15 +65,17 @@ export default {
           md: 24,
           attributes: { disabled: true, placeholder: '请输入' },
           formItemAttributes: { label: '工单单号', prop: 'id' },
-          slots:{
+          slots: {
             append: (h, { props, onInput }) => {
-              return <copyInfo
-                btnys={true}
-                slot="append"
-                text="复制"
-                columnCopyClass="columnCopyClass_cp_888aa"
-                cpText={props?.formData?.id}
-              ></copyInfo>
+              return (
+                <copyInfo
+                  btnys={true}
+                  slot="append"
+                  text="复制"
+                  columnCopyClass="columnCopyClass_cp_888aa"
+                  cpText={props?.formData?.id}
+                ></copyInfo>
+              )
             }
           }
         },
@@ -116,33 +124,35 @@ export default {
           formItemAttributes: { label: '接单时间', prop: 'workerReceTime' }
         },
         ...(() => {
-          var list = [];
-          (this.orderInfo.orderWorkers_cp || []).map(item => {
-            list.push({
-              name: 'slot-component',
-              md: 12,
-              formItemAttributes: { label: item.isMaster == '1' ? '主要工程师' : item.isMaster == '0' ? '辅助工程师' : '', prop: '' },
-              render: (h, { props, onInput }) => {
-                return (
-                  <el-input value={item.workerName} disabled={true} size="mini" ></el-input>
-                )
-              },
-              getValue: () => {
-                return item.workerName
-              }
-            }, {
-              name: 'slot-component',
-              md: 12,
-              formItemAttributes: { label: '手机号', prop: '' },
-              render: (h, { props, onInput }) => {
-                return (
-                  <el-input value={item.workerMobile} disabled={true} size="mini" ></el-input>
-                )
+          var list = []
+          ;(this.orderInfo.orderWorkers_cp || []).map(item => {
+            list.push(
+              {
+                name: 'slot-component',
+                md: 12,
+                formItemAttributes: {
+                  label: item.isMaster == '1' ? '主要工程师' : item.isMaster == '0' ? '辅助工程师' : '',
+                  prop: ''
+                },
+                render: (h, { props, onInput }) => {
+                  return <el-input value={item.workerName} disabled={true} size="mini"></el-input>
+                },
+                getValue: () => {
+                  return item.workerName
+                }
               },
-              getValue: () => {
-                return item.workerMobile
+              {
+                name: 'slot-component',
+                md: 12,
+                formItemAttributes: { label: '手机号', prop: '' },
+                render: (h, { props, onInput }) => {
+                  return <el-input value={item.workerMobile} disabled={true} size="mini"></el-input>
+                },
+                getValue: () => {
+                  return item.workerMobile
+                }
               }
-            })
+            )
           })
           return list
         })(),
@@ -175,6 +185,6 @@ export default {
           this.logList = res.data
         })
       }
-    },
+    }
   }
 }

+ 108 - 90
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/pandanxinxi.js

@@ -1,5 +1,5 @@
-import { getWebsit } from "@/api/customerManagement.js"
-import { memberListPageV2 } from "@/api/masterManagement";
+import { getWebsit } from '@/api/customerManagement.js'
+import { memberListPageV2 } from '@/api/masterManagement'
 
 export default {
   data() {
@@ -23,11 +23,7 @@ export default {
             prop: 'isMaster'
           },
           render: (h, { row, column, index }) => {
-            return (
-              <div style="padding-left:10px">
-                {row.isMaster ? '主要工程师' : '辅助工程师'}
-              </div>
-            )
+            return <div style="padding-left:10px">{row.isMaster ? '主要工程师' : '辅助工程师'}</div>
           }
         },
         {
@@ -47,18 +43,23 @@ export default {
             return [
               {
                 columnAttributes: {
-                  label: '操作',
+                  label: '操作'
                 },
                 render: (h, { row, column, index }) => {
                   return !row.isMaster ? (
                     <div style="padding-left:10px">
-                      <el-button type="text" onClick={() => {
-                        this.orderInfo.orderWorkers.splice(index, 1)
-                      }}>删除</el-button>
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          this.orderInfo.orderWorkers.splice(index, 1)
+                        }}
+                      >
+                        删除
+                      </el-button>
                     </div>
                   ) : null
                 }
-              },
+              }
             ]
           }
           return []
@@ -81,14 +82,14 @@ export default {
           formItemAttributes: {
             label: '网点名称',
             prop: 'websitId',
-            rules: this.formOptions.websitId.isRules,
+            rules: this.formOptions.websitId.isRules
           },
           events: {
-            change: (val) => {
-              this.orderInfo.workerId = ""
-              this.orderInfo.workerName = ""
-              this.orderInfo.workerIdcard = ""
-              this.orderInfo.workerMobile = ""
+            change: val => {
+              this.orderInfo.workerId = ''
+              this.orderInfo.workerName = ''
+              this.orderInfo.workerIdcard = ''
+              this.orderInfo.workerMobile = ''
               this.workerList = []
               this.orderInfo.orderWorkers = []
               this.getWorkers()
@@ -105,12 +106,12 @@ export default {
           name: 'el-switch',
           md: 8,
           attributes: {
-            disabled: !this.formOptions.isQd.isEdit,
+            disabled: !this.formOptions.isQd.isEdit
           },
           formItemAttributes: {
             label: '是否抢单',
             prop: 'isQd',
-            rules: this.formOptions.isQd.isRules,
+            rules: this.formOptions.isQd.isRules
           }
         },
         {
@@ -133,84 +134,94 @@ export default {
         },
         ...(() => {
           if (this.formOptions.workerId.isEdit) {
-            return [{
-              isShow: this.formOptions.workerId.isShow,
-              name: 'el-select',
-              options: this.workerList.filter(item => this.orderInfo.workerId == item.value || !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)),
-              md: 8,
-              attributes: {
-                disabled: !this.formOptions.workerId.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '主要工程师',
-                prop: 'workerId',
-                rules: this.formOptions.workerId.isRules,
-              },
-              events: {
-                change: (val) => {
-                  var index = this.orderInfo.orderWorkers.map(item => item.isMaster).indexOf(true)
-                  if (!!~index) {
-                    this.orderInfo.orderWorkers.splice(index, 1)
-                  }
-                  if (val) {
-                    var data = this.workerList.find(item => item.value == val).data
-                    this.orderInfo.workerName = data.workerName
-                    this.orderInfo.workerIdcard = data.workerIdcard
-                    this.orderInfo.workerMobile = data.workerMobile
-                    this.orderInfo.orderWorkers.unshift({ ...data, isMaster: true })
-                    if (data.slaveWorkerId) {
-                      var data2 = this.workerList.find(item => item.value == data.slaveWorkerId).data
-                      this.orderInfo.orderWorkers.push({ ...data2, isMaster: false })
-                      this.orderInfo.workerId_fz = ""
+            return [
+              {
+                isShow: this.formOptions.workerId.isShow,
+                name: 'el-select',
+                options: this.workerList.filter(
+                  item =>
+                    this.orderInfo.workerId == item.value ||
+                    !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)
+                ),
+                md: 8,
+                attributes: {
+                  disabled: !this.formOptions.workerId.isEdit,
+                  placeholder: '请选择',
+                  clearable: true,
+                  filterable: true
+                },
+                formItemAttributes: {
+                  label: '主要工程师',
+                  prop: 'workerId',
+                  rules: this.formOptions.workerId.isRules
+                },
+                events: {
+                  change: val => {
+                    var index = this.orderInfo.orderWorkers.map(item => item.isMaster).indexOf(true)
+                    if (!!~index) {
+                      this.orderInfo.orderWorkers.splice(index, 1)
                     }
-                    if (this.orderInfo.orderWorkers.length > 1) {
-                      this.orderInfo.orderWorkers.map((item, index) => {
-                        if (index > 0) {
-                          item.isMaster = false
-                        }
-                      })
+                    if (val) {
+                      var data = this.workerList.find(item => item.value == val).data
+                      this.orderInfo.workerName = data.workerName
+                      this.orderInfo.workerIdcard = data.workerIdcard
+                      this.orderInfo.workerMobile = data.workerMobile
+                      this.orderInfo.orderWorkers.unshift({ ...data, isMaster: true })
+                      if (data.slaveWorkerId) {
+                        var data2 = this.workerList.find(item => item.value == data.slaveWorkerId).data
+                        this.orderInfo.orderWorkers.push({ ...data2, isMaster: false })
+                        this.orderInfo.workerId_fz = ''
+                      }
+                      if (this.orderInfo.orderWorkers.length > 1) {
+                        this.orderInfo.orderWorkers.map((item, index) => {
+                          if (index > 0) {
+                            item.isMaster = false
+                          }
+                        })
+                      }
+                    } else {
+                      this.orderInfo.workerName = ''
+                      this.orderInfo.workerIdcard = ''
+                      this.orderInfo.workerMobile = ''
                     }
-                  } else {
-                    this.orderInfo.workerName = ""
-                    this.orderInfo.workerIdcard = ""
-                    this.orderInfo.workerMobile = ""
                   }
                 }
               }
-            }]
+            ]
           }
           return []
         })(),
         ...(() => {
           if (this.formOptions.orderWorkers.isEdit) {
-            return [{
-              isShow: this.formOptions.orderWorkers.isEdit,
-              name: 'el-select',
-              options: this.workerList.filter(item => !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)),
-              md: 8,
-              attributes: {
-                disabled: !this.formOptions.orderWorkers.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '辅助工程师',
-                prop: 'workerId_fz',
-              },
-              events: {
-                change: (val) => {
-                  if (val) {
-                    var data = this.workerList.find(item => item.value == val).data
-                    this.orderInfo.orderWorkers.push({ ...data, isMaster: false })
-                    this.orderInfo.workerId_fz = ""
+            return [
+              {
+                isShow: this.formOptions.orderWorkers.isEdit,
+                name: 'el-select',
+                options: this.workerList.filter(
+                  item => !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)
+                ),
+                md: 8,
+                attributes: {
+                  disabled: !this.formOptions.orderWorkers.isEdit,
+                  placeholder: '请选择',
+                  clearable: true,
+                  filterable: true
+                },
+                formItemAttributes: {
+                  label: '辅助工程师',
+                  prop: 'workerId_fz'
+                },
+                events: {
+                  change: val => {
+                    if (val) {
+                      var data = this.workerList.find(item => item.value == val).data
+                      this.orderInfo.orderWorkers.push({ ...data, isMaster: false })
+                      this.orderInfo.workerId_fz = ''
+                    }
                   }
                 }
               }
-            }]
+            ]
           }
           return []
         })(),
@@ -221,7 +232,7 @@ export default {
           formItemAttributes: {
             label: '已选工程师',
             prop: 'orderWorkers',
-            rules: this.formOptions.orderWorkers.isRules,
+            rules: this.formOptions.orderWorkers.isRules
           },
           render: (h, { props }) => {
             var { formData } = props
@@ -241,8 +252,8 @@ export default {
   },
   created() {
     // 普通工单选择网点数据
-    if (!!~[1,2,3].indexOf(this?.workOrderType) || this.isAllWebsit) {
-      getWebsit({ type: "C", status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
+    if (!!~[1, 2, 3].indexOf(this?.workOrderType) || this.isAllWebsit) {
+      getWebsit({ type: 'C', status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
         this.websitList = res.data.map(item => ({
           label: item.name,
           value: item.websitId,
@@ -254,7 +265,14 @@ export default {
   methods: {
     getWorkers() {
       if (this.orderInfo.websitId) {
-        memberListPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.examine_status", "compare": "=", "value": "OK" }, { "param": "b.websit_id", "compare": "=", "value": this.orderInfo.websitId }] }).then(res => {
+        memberListPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'b.examine_status', compare: '=', value: 'OK' },
+            { param: 'b.websit_id', compare: '=', value: this.orderInfo.websitId }
+          ]
+        }).then(res => {
           this.workerList = res.data.records.map(item => {
             var { id, userId, ...data } = item
             return {
@@ -272,5 +290,5 @@ export default {
         })
       }
     }
-  },
+  }
 }

+ 303 - 190
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/productColumns.js

@@ -1,7 +1,12 @@
 import { getClassifyList } from '@/api/goods'
 import { getDataDictionary } from '@/api/dataDictionary.js'
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { orderBaseProductList, orderBaseProductAdd, orderBaseProductUpdate, orderBaseProductDelete } from "@/api/workOrderPool.js"
+import {
+  orderBaseProductList,
+  orderBaseProductAdd,
+  orderBaseProductUpdate,
+  orderBaseProductDelete
+} from '@/api/workOrderPool.js'
 export default {
   data() {
     return {
@@ -20,25 +25,39 @@ export default {
             prop: 'brandId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={this.orderInfo.isCj ? [] : []}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    if (val) {
-                      var data = this.orderBrands.find(item => item.value == val)
-                      row.brandName = data.label
-                    } else {
-                      row.brandName = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {this.orderBrands.map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.brandName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={this.orderInfo.isCj ? [] : []}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      if (val) {
+                        var data = this.orderBrands.find(item => item.value == val)
+                        row.brandName = data.label
+                      } else {
+                        row.brandName = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.orderBrands.map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.brandName}</div>
+            )
           }
         },
         {
@@ -47,29 +66,43 @@ export default {
             prop: 'mainId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={this.orderInfo.isCj ? [] : required}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    row.smallId = ""
-                    row.smallName = ""
-                    if (val) {
-                      var data = this.classifyList.find(item => item.categoryId == val)
-                      row.mainName = data.name
-                      row.imgUrl = data.imgUrl
-                    } else {
-                      row.mainName = ""
-                      row.imgUrl = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {this.classifyList.map((item, index_) => <el-option key={index_} label={item.name} value={item.categoryId}></el-option>)}
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.mainName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={this.orderInfo.isCj ? [] : required}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      row.smallId = ''
+                      row.smallName = ''
+                      if (val) {
+                        var data = this.classifyList.find(item => item.categoryId == val)
+                        row.mainName = data.name
+                        row.imgUrl = data.imgUrl
+                      } else {
+                        row.mainName = ''
+                        row.imgUrl = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.classifyList.map((item, index_) => (
+                      <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.mainName}</div>
+            )
           }
         },
         {
@@ -78,25 +111,41 @@ export default {
             prop: 'smallId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={this.orderInfo.isCj ? [] : []}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    if (val) {
-                      var data = this.classifyListLv2.find(item => item.categoryId == val)
-                      row.smallName = data.name
-                    } else {
-                      row.smallName = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {this.classifyListLv2.filter(item => item.parentId === row.mainId).map((item, index_) => <el-option key={index_} label={item.name} value={item.categoryId}></el-option>)}
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.smallName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={this.orderInfo.isCj ? [] : []}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      if (val) {
+                        var data = this.classifyListLv2.find(item => item.categoryId == val)
+                        row.smallName = data.name
+                      } else {
+                        row.smallName = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.classifyListLv2
+                      .filter(item => item.parentId === row.mainId)
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.smallName}</div>
+            )
           }
         },
         {
@@ -105,17 +154,26 @@ export default {
             prop: 'productName'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`}>
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
                 >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -124,17 +182,22 @@ export default {
             prop: 'insideCode'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px">
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
-                >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item label="" label-width="0px">
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -143,17 +206,27 @@ export default {
             prop: 'num'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={this.orderInfo.isCj ? [] : required}>
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={this.orderInfo.isCj ? [] : required}
                 >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -162,17 +235,22 @@ export default {
             prop: 'remark'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px">
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
-                >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item label="" label-width="0px">
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         ...(() => {
@@ -180,22 +258,43 @@ export default {
             return [
               {
                 columnAttributes: {
-                  label: '操作',
+                  label: '操作'
                 },
                 render: (h, { row, column, index }) => {
-                  return <div style="padding-left:10px">
-                    <el-button type="text" onClick={() => {
-                      this.delProduct(row, index)
-                    }}>删除</el-button>
-                    {this.isEditIndex == index && <el-button type="text" onClick={() => {
-                      this.eidtProduct(row, index)
-                    }}>确定</el-button>}
-                    {this.isEditIndex == -1 && <el-button type="text" onClick={() => {
-                      this.isEditIndex = index
-                    }}>编辑</el-button>}
-                  </div>
+                  return (
+                    <div style="padding-left:10px">
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          this.delProduct(row, index)
+                        }}
+                      >
+                        删除
+                      </el-button>
+                      {this.isEditIndex == index && (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.eidtProduct(row, index)
+                          }}
+                        >
+                          确定
+                        </el-button>
+                      )}
+                      {this.isEditIndex == -1 && (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.isEditIndex = index
+                          }}
+                        >
+                          编辑
+                        </el-button>
+                      )}
+                    </div>
+                  )
                 }
-              },
+              }
             ]
           }
           return []
@@ -203,74 +302,89 @@ export default {
       ]
     },
     product() {
-      return [{
-        isShow: this.formOptions.orderProducts.isShow,
-        name: 'slot-component',
-        md: 24,
-        formItemAttributes: {
-          label: '',
-          'label-width': '0px',
-          prop: 'orderProducts',
-          errLabel: '产品信息',
-          rules: this.formOptions.orderProducts.isRules
-        },
-        render: (h, { props }) => {
-          return (
-            <div>
-              {this.formOptions.orderProducts.isEdit ? <div>
-                <el-button size="mini" type="primary" onClick={() => {
-                  this.appointVerify(this.getVfyKey(this.isEditIndex, false), (v) => {
-                    if (v) {
-                      try {
-                        this.orderInfo.orderProducts.map((item, index_) => {
-                          var row = this.orderInfo.orderProducts[index_ + 1]
-                          if (row) {
-                            if (
-                              `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
-                            ) {
-                              throw new Error('');
+      return [
+        {
+          isShow: this.formOptions.orderProducts.isShow,
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '',
+            'label-width': '0px',
+            prop: 'orderProducts',
+            errLabel: '产品信息',
+            rules: this.formOptions.orderProducts.isRules
+          },
+          render: (h, { props }) => {
+            return (
+              <div>
+                {this.formOptions.orderProducts.isEdit ? (
+                  <div>
+                    <el-button
+                      size="mini"
+                      type="primary"
+                      onClick={() => {
+                        this.appointVerify(this.getVfyKey(this.isEditIndex, false), v => {
+                          if (v) {
+                            try {
+                              this.orderInfo.orderProducts.map((item, index_) => {
+                                var row = this.orderInfo.orderProducts[index_ + 1]
+                                if (row) {
+                                  if (
+                                    `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` ==
+                                    `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
+                                  ) {
+                                    throw new Error('')
+                                  }
+                                }
+                              })
+                            } catch (error) {
+                              this.$message.warning('产品机型重复')
+                              return
                             }
+                            this.isEditIndex = 0
+                            this.orderInfo.orderProducts.unshift({
+                              brandId: '',
+                              brandName: '',
+                              createBy: '',
+                              createTime: '',
+                              mainId: '',
+                              mainName: '',
+                              num: '',
+                              insideCode: '',
+                              orderBaseId: this.id || '',
+                              productId: '',
+                              productName: '',
+                              remark: '',
+                              smallId: '',
+                              smallName: '',
+                              imgUrl: ''
+                            })
                           }
                         })
-                      } catch (error) {
-                        this.$message.warning('产品机型重复')
-                        return
-                      }
-                      this.isEditIndex = 0
-                      this.orderInfo.orderProducts.unshift({
-                        "brandId": "",
-                        "brandName": "",
-                        "createBy": "",
-                        "createTime": "",
-                        "mainId": "",
-                        "mainName": "",
-                        "num": "",
-                        "insideCode": "",
-                        "orderBaseId": this.id || '',
-                        "productId": "",
-                        "productName": "",
-                        "remark": "",
-                        "smallId": "",
-                        "smallName": "",
-                        "imgUrl": ""
-                      })
-                    }
-                  })
-                }}>新增</el-button>
-              </div> : null}
-              <zj-table
-                columns={this.productColumns}
-                table-data={this.orderInfo.orderProducts}
-              />
-            </div>
-          )
+                      }}
+                    >
+                      新增
+                    </el-button>
+                  </div>
+                ) : null}
+                <zj-table columns={this.productColumns} table-data={this.orderInfo.orderProducts} />
+              </div>
+            )
+          }
         }
-      }]
-    },
+      ]
+    }
   },
   created() {
     // 获取品牌
-    getDataDictionary({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.dict_type", "compare": "=", "value": "BRAND" }] }).then(res => {
+    getDataDictionary({
+      pageNum: 1,
+      pageSize: -1,
+      params: [
+        { param: 'a.status', compare: '=', value: 'ON' },
+        { param: 'a.dict_type', compare: '=', value: 'BRAND' }
+      ]
+    }).then(res => {
       this.orderBrands = res.data.records.map(item => ({
         value: item.dictCode,
         label: item.dictValue
@@ -285,7 +399,7 @@ export default {
         return {
           ...data
         }
-      });
+      })
       this.classifyListLv2 = classifyListLv2
     })
   },
@@ -294,9 +408,7 @@ export default {
       return [
         ...(() => {
           if (bool) {
-            return [
-              `orderProducts`,
-            ]
+            return [`orderProducts`]
           }
           return []
         })(),
@@ -308,7 +420,7 @@ export default {
               // `orderProducts.${index}.smallId`,
               `orderProducts.${index}.productName`,
               `orderProducts.${index}.num`,
-              `orderProducts.${index}.remark`,
+              `orderProducts.${index}.remark`
             ]
           }
           return []
@@ -320,7 +432,7 @@ export default {
       if (this.id) {
         orderBaseProductList({
           orderBaseId: this.id
-        }).then((res) => {
+        }).then(res => {
           this.orderInfo.orderProducts = res.data || []
         })
       }
@@ -329,20 +441,21 @@ export default {
       try {
         this.orderInfo.orderProducts.map((item, index_) => {
           if (
-            `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}` &&
+            `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` ==
+              `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}` &&
             index_ != index
           ) {
-            throw new Error('');
+            throw new Error('')
           }
         })
       } catch (error) {
         this.$message.warning('产品机型重复')
         return
       }
-      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+      this.appointVerify(this.getVfyKey(this.isEditIndex), v => {
         if (v) {
           if (this.id) {
-            [orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
+            ;[orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
               this.isEditIndex = -1
               this.getOrderBaseProduct()
               this.getOrderBaseLogList()
@@ -354,7 +467,7 @@ export default {
       })
     },
     delProduct(row, index) {
-      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+      this.appointVerify(this.getVfyKey(this.isEditIndex), v => {
         if (v && this.id && row.id) {
           orderBaseProductDelete({
             orderProductId: row.id
@@ -367,5 +480,5 @@ export default {
         }
       })
     }
-  },
+  }
 }

+ 30 - 16
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js

@@ -1,4 +1,4 @@
-import { listPageV2 } from "@/api/workOrder/orderType";
+import { listPageV2 } from '@/api/workOrder/orderType'
 import { getDataDictionary } from '@/api/dataDictionary.js'
 
 export default {
@@ -28,7 +28,7 @@ export default {
             rules: this.formOptions.orderSmallType.isRules
           },
           events: {
-            change: (val) => {
+            change: val => {
               if (val) {
                 this.orderInfo.orderSmallTypeText = this.orderSmallTypeData.find(item => item.value == val).label
               } else {
@@ -42,7 +42,7 @@ export default {
           name: 'el-input',
           md: 6,
           attributes: {
-            disabled: !this.formOptions.orderSmallType.isEdit,
+            disabled: !this.formOptions.orderSmallType.isEdit
           },
           formItemAttributes: {
             label: '工单类型',
@@ -67,7 +67,7 @@ export default {
             rules: this.formOptions.orderChannelId.isRules
           },
           events: {
-            change: (val) => {
+            change: val => {
               if (val) {
                 this.orderInfo.orderChannelText = this.orderChannels.find(item => item.value == val).label
               } else {
@@ -134,7 +134,7 @@ export default {
             'value-format': 'yyyy-MM-dd HH:mm:ss',
             'picker-options': {
               disabledDate: time => {
-                return time.getTime() < (Date.now() - 86400000)
+                return time.getTime() < Date.now() - 86400000
               }
             }
           },
@@ -148,7 +148,12 @@ export default {
           isShow: this.formOptions.saleType.isShow,
           name: 'el-select',
           md: 6,
-          options: [{ value: 1, label: '零售' }, { value: 2, label: '工程' }, { value: 3, label: '延保' }, { value: 4, label: '工程维保' }],
+          options: [
+            { value: 1, label: '零售' },
+            { value: 2, label: '工程' },
+            { value: 3, label: '延保' },
+            { value: 4, label: '工程维保' }
+          ],
           attributes: {
             disabled: !this.formOptions.saleType.isEdit,
             placeholder: '请选择',
@@ -188,27 +193,36 @@ export default {
             prop: 'source',
             rules: this.formOptions.source.isRules
           }
-        },
+        }
       ]
     }
   },
   created() {
     // 普通工单选择网点数据
-    if (!!~[1,2,3].indexOf(this?.workOrderType)) {
+    if (!!~[1, 2, 3].indexOf(this?.workOrderType)) {
       // 获取工单类型
-      listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
-        this.orderSmallTypeData = res.data.records.map(item => ({
-          value: item.id,
-          label: item.orderSmallTypeText
-        }))
-      })
+      listPageV2({ pageNum: 1, pageSize: -1, params: [{ param: 'a.status', compare: '=', value: 'true' }] }).then(
+        res => {
+          this.orderSmallTypeData = res.data.records.map(item => ({
+            value: item.id,
+            label: item.orderSmallTypeText
+          }))
+        }
+      )
     }
     // 获取工单来源
-    getDataDictionary({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.dict_type", "compare": "=", "value": "ORDER_CHANNEL" }] }).then(res => {
+    getDataDictionary({
+      pageNum: 1,
+      pageSize: -1,
+      params: [
+        { param: 'a.status', compare: '=', value: 'ON' },
+        { param: 'a.dict_type', compare: '=', value: 'ORDER_CHANNEL' }
+      ]
+    }).then(res => {
       this.orderChannels = res.data.records.map(item => ({
         value: item.dictCode,
         label: item.dictValue
       }))
     })
-  },
+  }
 }

+ 316 - 200
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/wb_productColumns.js

@@ -1,7 +1,12 @@
 import { getClassifyList } from '@/api/goods'
 import { getDataDictionary } from '@/api/dataDictionary.js'
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { orderBaseProductList, orderBaseProductAdd, orderBaseProductUpdate, orderBaseProductDelete } from "@/api/workOrderPool.js"
+import {
+  orderBaseProductList,
+  orderBaseProductAdd,
+  orderBaseProductUpdate,
+  orderBaseProductDelete
+} from '@/api/workOrderPool.js'
 export default {
   data() {
     return {
@@ -18,25 +23,39 @@ export default {
             prop: 'brandId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    if (val) {
-                      var data = this.huoquweiyi('brandId', 'brandName').find(item => item.value == val)
-                      row.brandName = data.label
-                    } else {
-                      row.brandName = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {this.huoquweiyi('brandId', 'brandName').map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.brandName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      if (val) {
+                        var data = this.huoquweiyi('brandId', 'brandName').find(item => item.value == val)
+                        row.brandName = data.label
+                      } else {
+                        row.brandName = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.huoquweiyi('brandId', 'brandName').map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.brandName}</div>
+            )
           }
         },
         {
@@ -45,33 +64,53 @@ export default {
             prop: 'mainId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    row.smallId = ""
-                    row.smallName = ""
-                    if (val) {
-                      var data = this.huoquweiyi('mainId', 'mainName').filter(item => {
-                        return !!this.productList_wb.filter(v => v.mainId == item.value).find(v2 => v2.brandId == row.brandId)
-                      }).find(item => item.value == val)
-                      row.mainName = data.label
-                    } else {
-                      row.mainName = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {
-                    this.huoquweiyi('mainId', 'mainName').filter(item => {
-                      return !!this.productList_wb.filter(v => v.mainId == item.value).find(v2 => v2.brandId == row.brandId)
-                    }).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)
-                  }
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.mainName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      row.smallId = ''
+                      row.smallName = ''
+                      if (val) {
+                        var data = this.huoquweiyi('mainId', 'mainName')
+                          .filter(item => {
+                            return !!this.productList_wb
+                              .filter(v => v.mainId == item.value)
+                              .find(v2 => v2.brandId == row.brandId)
+                          })
+                          .find(item => item.value == val)
+                        row.mainName = data.label
+                      } else {
+                        row.mainName = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.huoquweiyi('mainId', 'mainName')
+                      .filter(item => {
+                        return !!this.productList_wb
+                          .filter(v => v.mainId == item.value)
+                          .find(v2 => v2.brandId == row.brandId)
+                      })
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.label} value={item.value}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.mainName}</div>
+            )
           }
         },
         {
@@ -80,33 +119,53 @@ export default {
             prop: 'smallId'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
-                <el-select
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  onChange={(val) => {
-                    if (val) {
-                      var data = this.huoquweiyi('smallId', 'smallName', "smallImg").filter(item => {
-                        return !!this.productList_wb.filter(v => v.smallId == item.value).find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
-                      }).find(item => item.value == val)
-                      row.smallName = data.label
-                      row.imgUrl = data.smallImg
-                    } else {
-                      row.smallName = ""
-                      row.imgUrl = ""
-                    }
-                  }}
-                  placeholder="请选择">
-                  {
-                    this.huoquweiyi('smallId', 'smallName', "smallImg").filter(item => {
-                      return !!this.productList_wb.filter(v => v.smallId == item.value).find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
-                    }).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)
-                  }
-                </el-select>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row.smallName}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      if (val) {
+                        var data = this.huoquweiyi('smallId', 'smallName', 'smallImg')
+                          .filter(item => {
+                            return !!this.productList_wb
+                              .filter(v => v.smallId == item.value)
+                              .find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
+                          })
+                          .find(item => item.value == val)
+                        row.smallName = data.label
+                        row.imgUrl = data.smallImg
+                      } else {
+                        row.smallName = ''
+                        row.imgUrl = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.huoquweiyi('smallId', 'smallName', 'smallImg')
+                      .filter(item => {
+                        return !!this.productList_wb
+                          .filter(v => v.smallId == item.value)
+                          .find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
+                      })
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.label} value={item.value}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row.smallName}</div>
+            )
           }
         },
         {
@@ -115,17 +174,26 @@ export default {
             prop: 'productName'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`}>
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
                 >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -134,17 +202,22 @@ export default {
             prop: 'insideCode'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px">
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
-                >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item label="" label-width="0px">
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -153,17 +226,27 @@ export default {
             prop: 'num'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  label-width="0px"
+                  prop={`orderProducts.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
                 >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         {
@@ -172,17 +255,22 @@ export default {
             prop: 'remark'
           },
           render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? <div class="redbordererr">
-              <el-form-item label="" label-width="0px">
-                <el-input
-                  disabled={!this.formOptions.orderProducts.isEdit}
-                  value={row[column.columnAttributes.prop]}
-                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
-                  placeholder="请输入内容"
-                >
-                </el-input>
-              </el-form-item>
-            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item label="" label-width="0px">
+                  <el-input
+                    disabled={!this.formOptions.orderProducts.isEdit}
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入内容"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+            )
           }
         },
         ...(() => {
@@ -190,22 +278,43 @@ export default {
             return [
               {
                 columnAttributes: {
-                  label: '操作',
+                  label: '操作'
                 },
                 render: (h, { row, column, index }) => {
-                  return <div style="padding-left:10px">
-                    <el-button type="text" onClick={() => {
-                      this.delProduct_wb(row, index)
-                    }}>删除</el-button>
-                    {this.isEditIndex == index && <el-button type="text" onClick={() => {
-                      this.eidtProduct_wb(row, index)
-                    }}>确定</el-button>}
-                    {this.isEditIndex == -1 && <el-button type="text" onClick={() => {
-                      this.isEditIndex = index
-                    }}>编辑</el-button>}
-                  </div>
+                  return (
+                    <div style="padding-left:10px">
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          this.delProduct_wb(row, index)
+                        }}
+                      >
+                        删除
+                      </el-button>
+                      {this.isEditIndex == index && (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.eidtProduct_wb(row, index)
+                          }}
+                        >
+                          确定
+                        </el-button>
+                      )}
+                      {this.isEditIndex == -1 && (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.isEditIndex = index
+                          }}
+                        >
+                          编辑
+                        </el-button>
+                      )}
+                    </div>
+                  )
                 }
-              },
+              }
             ]
           }
           return []
@@ -213,70 +322,78 @@ export default {
       ]
     },
     product_wb() {
-      return [{
-        isShow: this.formOptions.orderProducts.isShow,
-        name: 'slot-component',
-        md: 24,
-        formItemAttributes: {
-          label: '',
-          'label-width': '0px',
-          prop: 'orderProducts',
-          errLabel: '产品信息',
-          rules: this.formOptions.orderProducts.isRules
-        },
-        render: (h, { props }) => {
-          return (
-            <div>
-              {this.formOptions.orderProducts.isEdit ? <div>
-                <el-button size="mini" type="primary" onClick={() => {
-                  this.appointVerify(this.getVfyKey_wb(this.isEditIndex, false), (v) => {
-                    if (v) {
-                      try {
-                        this.orderInfo.orderProducts.map((item, index_) => {
-                          var row = this.orderInfo.orderProducts[index_ + 1]
-                          if (row) {
-                            if (
-                              `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
-                            ) {
-                              throw new Error('');
+      return [
+        {
+          isShow: this.formOptions.orderProducts.isShow,
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '',
+            'label-width': '0px',
+            prop: 'orderProducts',
+            errLabel: '产品信息',
+            rules: this.formOptions.orderProducts.isRules
+          },
+          render: (h, { props }) => {
+            return (
+              <div>
+                {this.formOptions.orderProducts.isEdit ? (
+                  <div>
+                    <el-button
+                      size="mini"
+                      type="primary"
+                      onClick={() => {
+                        this.appointVerify(this.getVfyKey_wb(this.isEditIndex, false), v => {
+                          if (v) {
+                            try {
+                              this.orderInfo.orderProducts.map((item, index_) => {
+                                var row = this.orderInfo.orderProducts[index_ + 1]
+                                if (row) {
+                                  if (
+                                    `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` ==
+                                    `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
+                                  ) {
+                                    throw new Error('')
+                                  }
+                                }
+                              })
+                            } catch (error) {
+                              this.$message.warning('产品机型重复')
+                              return
                             }
+                            this.isEditIndex = 0
+                            this.orderInfo.orderProducts.unshift({
+                              brandId: '',
+                              brandName: '',
+                              createBy: '',
+                              createTime: '',
+                              mainId: '',
+                              mainName: '',
+                              num: '',
+                              insideCode: '',
+                              orderBaseId: this.id || '',
+                              productId: '',
+                              productName: '',
+                              remark: '',
+                              smallId: '',
+                              smallName: '',
+                              imgUrl: ''
+                            })
                           }
                         })
-                      } catch (error) {
-                        this.$message.warning('产品机型重复')
-                        return
-                      }
-                      this.isEditIndex = 0
-                      this.orderInfo.orderProducts.unshift({
-                        "brandId": "",
-                        "brandName": "",
-                        "createBy": "",
-                        "createTime": "",
-                        "mainId": "",
-                        "mainName": "",
-                        "num": "",
-                        "insideCode": "",
-                        "orderBaseId": this.id || '',
-                        "productId": "",
-                        "productName": "",
-                        "remark": "",
-                        "smallId": "",
-                        "smallName": "",
-                        "imgUrl": ""
-                      })
-                    }
-                  })
-                }}>新增</el-button>
-              </div> : null}
-              <zj-table
-                columns={this.productColumns_wb}
-                table-data={this.orderInfo.orderProducts}
-              />
-            </div>
-          )
+                      }}
+                    >
+                      新增
+                    </el-button>
+                  </div>
+                ) : null}
+                <zj-table columns={this.productColumns_wb} table-data={this.orderInfo.orderProducts} />
+              </div>
+            )
+          }
         }
-      }]
-    },
+      ]
+    }
   },
   methods: {
     huoquweiyi(value, label, ...keys) {
@@ -300,9 +417,7 @@ export default {
       return [
         ...(() => {
           if (bool) {
-            return [
-              `orderProducts`,
-            ]
+            return [`orderProducts`]
           }
           return []
         })(),
@@ -314,7 +429,7 @@ export default {
               `orderProducts.${index}.smallId`,
               `orderProducts.${index}.productName`,
               `orderProducts.${index}.num`,
-              `orderProducts.${index}.remark`,
+              `orderProducts.${index}.remark`
             ]
           }
           return []
@@ -326,7 +441,7 @@ export default {
       if (this.id) {
         orderBaseProductList({
           orderBaseId: this.id
-        }).then((res) => {
+        }).then(res => {
           this.orderInfo.orderProducts = res.data || []
         })
       }
@@ -335,20 +450,21 @@ export default {
       try {
         this.orderInfo.orderProducts.map((item, index_) => {
           if (
-            `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}` &&
+            `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` ==
+              `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}` &&
             index_ != index
           ) {
-            throw new Error('');
+            throw new Error('')
           }
         })
       } catch (error) {
         this.$message.warning('产品机型重复')
         return
       }
-      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), (v) => {
+      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), v => {
         if (v) {
           if (this.id) {
-            [orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
+            ;[orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
               this.isEditIndex = -1
               this.getOrderBaseProduct_wb()
               this.getOrderBaseLogList()
@@ -360,7 +476,7 @@ export default {
       })
     },
     delProduct_wb(row, index) {
-      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), (v) => {
+      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), v => {
         if (v && this.id && row.id) {
           orderBaseProductDelete({
             orderProductId: row.id
@@ -373,5 +489,5 @@ export default {
         }
       })
     }
-  },
+  }
 }

+ 70 - 70
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/workOrderLogic.js

@@ -1,56 +1,56 @@
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { orderBaseDetail, orderBaseProductList } from "@/api/workOrderPool.js"
+import { orderBaseDetail, orderBaseProductList } from '@/api/workOrderPool.js'
 var initdata_ = {
   // 基础信息--------------------
   // 维保项目
-  rpProjectRepairId: "",
+  rpProjectRepairId: '',
   // 工程编号
-  projectNo: "",
+  projectNo: '',
   // 工程名称
-  projectName: "",
+  projectName: '',
   // 客户名称
-  userName: "",
+  userName: '',
   // 联系人
-  linkName: "",
+  linkName: '',
   // 客户电话
-  userMobile: "",
+  userMobile: '',
   // 客户电话2
-  userMobile2: "",
+  userMobile2: '',
   // 省
-  provinceId: "",
+  provinceId: '',
   // 市
-  cityId: "",
+  cityId: '',
   // 区
-  areaId: "",
+  areaId: '',
   // 街道
-  streetId: "",
+  streetId: '',
   // gps地址
-  gpsAddress: "",
+  gpsAddress: '',
   // 详细地址
-  address: "",
+  address: '',
   // 服务信息--------------------------------
   // 工单类型
-  orderSmallType: "",
+  orderSmallType: '',
   // 工单来源
-  orderChannelId: "",
+  orderChannelId: '',
   // 预约上门日期
-  appointmentTime: "",
+  appointmentTime: '',
   // 销售单位
-  saleCompany: "",
-  source: "",
-  saleType: "",
+  saleCompany: '',
+  source: '',
+  saleType: '',
   // 产品信息------------------------
   orderProducts: [],
   // 其它信息------------------------
   // 备注
-  remark: "",
+  remark: '',
   // 派单信息-----------------------------
   // 服务商网点
-  websitId: "",
+  websitId: '',
   // 是否抢单
   isQd: false,
   // 主要工程师id
-  workerId: "",
+  workerId: '',
   // 工程师列表
   orderWorkers: [],
   orderWorkers_cp: [],
@@ -62,26 +62,26 @@ export default {
   props: {
     id: {
       type: [String, Number],
-      default: null,
+      default: null
     },
     workOrderType: {
       type: Number,
-      default: 1, // 1普通工单, 4维保工单
+      default: 1 // 1普通工单, 4维保工单
     },
     cloneWorkOrder: {
       type: Object,
-      default: null,
-    },
+      default: null
+    }
   },
   data() {
     return {
-      orderInfo: null,
+      orderInfo: null
     }
   },
   watch: {
     id: {
       handler(newVal, oldVal) {
-        this.getorderDetail((data) => {
+        this.getorderDetail(data => {
           if (!!~[1, 2, 3].indexOf(this?.workOrderType)) {
             this.$nextTick(() => {
               // 获取地址信息
@@ -99,8 +99,8 @@ export default {
         this.getOrderBaseLogList()
       },
       deep: true,
-      immediate: true,
-    },
+      immediate: true
+    }
   },
   computed: {
     // 用户信息
@@ -110,7 +110,6 @@ export default {
     // 判断工单状态
     orderType() {
       if (this.orderInfo) {
-
       }
       return -1
     },
@@ -119,39 +118,40 @@ export default {
       // 1,保存 2,过程反馈 3,设为异常 4,加急 5,不加急 6,取消工单 7,回访 8,新建工单 9,工单驳回 10,激活工单
       var btns = []
       if (this.orderInfo) {
-        btns = ({
-          // 待预约
-          DYY: [],
-          // 待商户派工
-          DSHPG: [1, 2, 4, 5, 6],
-          // 待网点派工
-          DWDPG: [1, 2, 4, 5, 6],
-          // 待接单
-          DJD: [1, 2, 4, 5, 6],
-          // 服务中
-          FWZ: [1, 2, 3, 4, 5, 6],
-          // 异常单
-          YCD: [1, 2, 6],
-          // 已完工待结算
-          YWG: [7, 8, 9],
-          // 已结算
-          YJS: [],
-          // 已取消
-          YQX: [10],
-          // 待抢单
-          DQD:[1, 2, 4, 5, 6],
-        }[this.orderInfo.orderStatus]) || []
+        btns =
+          {
+            // 待预约
+            DYY: [],
+            // 待商户派工
+            DSHPG: [1, 2, 4, 5, 6],
+            // 待网点派工
+            DWDPG: [1, 2, 4, 5, 6],
+            // 待接单
+            DJD: [1, 2, 4, 5, 6],
+            // 服务中
+            FWZ: [1, 2, 3, 4, 5, 6],
+            // 异常单
+            YCD: [1, 2, 6],
+            // 已完工待结算
+            YWG: [7, 8, 9],
+            // 已结算
+            YJS: [],
+            // 已取消
+            YQX: [10],
+            // 待抢单
+            DQD: [1, 2, 4, 5, 6]
+          }[this.orderInfo.orderStatus] || []
       }
 
       // 已经加急
-      if ((this.orderInfo.orderFlags||[]).find(item => item.tag == 'JIA_JI')) {
+      if ((this.orderInfo.orderFlags || []).find(item => item.tag == 'JIA_JI')) {
         btns = btns.filter(item => !new Set([4]).has(item))
       } else {
         btns = btns.filter(item => !new Set([5]).has(item))
       }
 
       // 已经异常
-      if ((this.orderInfo.orderFlags||[]).find(item => item.tag == 'YI_CHANGE')) {
+      if ((this.orderInfo.orderFlags || []).find(item => item.tag == 'YI_CHANGE')) {
         btns = btns.filter(item => !new Set([3]).has(item))
       }
 
@@ -282,7 +282,7 @@ export default {
           isEdit: !finish,
           isShow: true,
           isRules: this.userInfo.type != 1 && !this.orderInfo.isQd ? [...required] : []
-        },
+        }
       }
     },
     // 表单校验规则
@@ -302,28 +302,28 @@ export default {
           orderBaseProductList({
             orderBaseId: this.id
           })
-        ])
-          .then(([res, res1]) => {
-            this.orderInfo = {
-              ...res.data,
-              orderWorkers_cp: [...(res.data.orderWorkers || []).map(item => ({ ...item }))],
-              orderProducts: res1.data || [],
-              workerId_fz: "",
-            }
-            cb && cb(this.orderInfo)
-          })
-      } if(this.cloneWorkOrder){
+        ]).then(([res, res1]) => {
+          this.orderInfo = {
+            ...res.data,
+            orderWorkers_cp: [...(res.data.orderWorkers || []).map(item => ({ ...item }))],
+            orderProducts: res1.data || [],
+            workerId_fz: ''
+          }
+          cb && cb(this.orderInfo)
+        })
+      }
+      if (this.cloneWorkOrder) {
         // 创建工单
         this.orderInfo = Object.assign({}, JSON.parse(JSON.stringify(this.cloneWorkOrder)), {
           saleType: this?.workOrderType,
-          workerId_fz: ""
+          workerId_fz: ''
         })
         cb && cb(this.orderInfo)
       } else {
         // 创建工单
         this.orderInfo = Object.assign({}, JSON.parse(JSON.stringify(initdata_)), {
           saleType: this?.workOrderType,
-          workerId_fz: ""
+          workerId_fz: ''
         })
         cb && cb(this.orderInfo)
       }