xiongchao пре 3 година
родитељ
комит
ce0c73044f

+ 17 - 0
src/api/check/checkstandard.js

@@ -52,6 +52,23 @@ export function importCheckStandard (parameter) {
   })
 }
 
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function importCheckStandardOldVersion (parameter) {
+  return axios({
+    url: '/check/standards/import/old',
+    method: 'POST',
+    headers: {
+      'Content-Type': 'multipart/form-data;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
 /**
  * update func
  * parameter: { }

+ 7 - 0
src/utils/dict.js

@@ -803,6 +803,13 @@ DictCache.VALUE = {
     SPOT: 1, // 点检
     POLLING: 2 // 巡检
   },
+  /**
+   * 计划周期类型
+   */
+  CHECK_USER_TYPE: {
+    USE_USER: 1, // 使用人
+    REPAIR_USER: 2 // 维修人
+  },
   /**
    * 计划周期类型
    */

+ 6 - 0
src/views/check/checkjob/CheckJob.vue

@@ -174,6 +174,12 @@ export default {
           checked: true,
           width: '200px'
         },
+        {
+          title: '设备部位',
+          dataIndex: 'partName',
+          checked: true,
+          width: '150px'
+        },
         // {
         // title: '计划单号',
         // dataIndex: 'planNo',

+ 10 - 2
src/views/check/checkstandard/CheckStandard.vue

@@ -39,6 +39,10 @@
         <a-icon type="upload"/>
         新增导入
       </a-button>
+      <a-button style="margin-left:8px;" type="primary" @click="doImportOldVersion">
+        <a-icon type="upload"/>
+        老版本导入
+      </a-button>
       <a-button
         style="margin-left: 8px"
         v-if="($auth('check-spot-standards-export')||$auth('check-polling-standards-export'))"
@@ -233,6 +237,7 @@ export default {
       typeMap: {},
       enableMap: {},
       periodTypeMap: {},
+      checkUserTypeMap: {},
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         parameter = {
@@ -248,7 +253,6 @@ export default {
       },
       selectedRowKeys: [],
       selectedRows: [],
-
       options: {
         alert: {
           show: true,
@@ -270,6 +274,7 @@ export default {
     this.enableMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
     this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
+    this.checkUserTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_USER_TYPE)
     this.tableOption()
   },
   methods: {
@@ -349,7 +354,10 @@ export default {
       this.$refs.table.refresh(true)
     },
     doImport () {
-      this.$refs.importModal.base(null, null)
+      this.$refs.importModal.base(0)
+    },
+    doImportOldVersion () {
+      this.$refs.importModal.base(1)
     },
     doExport () {
       const parameter = {

+ 22 - 1
src/views/check/checkstandard/modules/BaseForm.vue

@@ -64,7 +64,25 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="执行人"
+            label="执行人方式"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select
+              v-decorator="['checkUserType', {initialValue: 1,rules: [{required: true, message: '执行人方式不能为空'}]}]"
+              placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in checkUserTypeMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="指定执行人"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
@@ -327,6 +345,7 @@ export default {
       actionTypeMap: {},
       paramTypeMap: {},
       enableMap: {},
+      checkUserTypeMap: {},
       periodTypeMap: {},
       checkImgList: [], // 图片
       checkFileList: [], // 文档
@@ -396,6 +415,7 @@ export default {
     this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
     this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
     this.enableMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
+    this.checkUserTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_USER_TYPE)
   },
   methods: {
     base (record, sbId) {
@@ -451,6 +471,7 @@ export default {
           'period',
           'part',
           'partName',
+          'checkUserType',
           'checkUserId',
           'periodType',
           // 'actionType',

+ 2 - 0
src/views/check/checkstandard/modules/Detail.vue

@@ -92,6 +92,7 @@ export default {
       // 下拉框map
       typeMap: {},
       periodTypeMap: {},
+      checkUserTypeMap: {},
       actionTypeMap: {},
       enableMap: {},
       model: {
@@ -134,6 +135,7 @@ export default {
     this.enableMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
     this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
+    this.checkUserTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_USER_TYPE)
   },
   methods: {
     inited (viewer) {

+ 2 - 0
src/views/check/checkstandard/modules/DetailSbCheck.vue

@@ -113,6 +113,7 @@ export default {
       modalTitle: null,
       visible: false,
       typeMap: {},
+      checkUserTypeMap: {},
       actionTypeMap: {},
       // 表头
       columns: [
@@ -167,6 +168,7 @@ export default {
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_STANDARD_TYPE)
     this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
     this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
+    this.checkUserTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_USER_TYPE)
   },
   methods: {
     base (record) {

+ 49 - 26
src/views/check/checkstandard/modules/ImportFormAdd.vue

@@ -37,7 +37,7 @@
 </template>
 
 <script>
-import { importCheckStandard } from '@/api/check/checkstandard'
+import { importCheckStandard, importCheckStandardOldVersion } from '@/api/check/checkstandard'
 
 export default {
   name: 'SbModelBomImportForm',
@@ -45,7 +45,6 @@ export default {
     return {
       confirmLoading: false,
       modalTitle: null,
-      sbId: null,
       form: this.$form.createForm(this),
       visible: false,
       type: null,
@@ -74,11 +73,10 @@ export default {
     }
   },
   methods: {
-    base (sbId) {
+    base (type) {
       this.visible = true
-      this.sbId = sbId
       this.modalTitle = '保养标准导入'
-      this.type = 1
+      this.type = type
     },
     handleRemove (file) {
       const index = this.fileList.indexOf(file)
@@ -122,28 +120,53 @@ export default {
         this.fileList.forEach(function (file) {
           formData.append('files', file, file.name)
         })
-        importCheckStandard(formData)
-          .then((res) => {
-            // 循环添加到formData中
-            const resultArr = res.data.split(';')
-            const result = []
-            for (let i = 0; i < resultArr.length; i++) {
-              const r = resultArr[i]
-              if (r.indexOf('成功') === 0) {
-                result.push({ id: i, name: r, status: '成功' })
-              } else if (r.indexOf('失败') === 0) {
-                result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
+        if (this.type !== 1) {
+          importCheckStandard(formData)
+            .then((res) => {
+              // 循环添加到formData中
+              const resultArr = res.data.split(';')
+              const result = []
+              for (let i = 0; i < resultArr.length; i++) {
+                const r = resultArr[i]
+                if (r.indexOf('成功') === 0) {
+                  result.push({ id: i, name: r, status: '成功' })
+                } else if (r.indexOf('失败') === 0) {
+                  result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
+                }
               }
-            }
-            this.$message.success('导入结束,请查看结果表格')
-            this.data = result
-            // this.handleCancel(values)
-            this.BaseTool.ListForm.clearOneList(this)
-            this.fileList = []
-            this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
-          }).catch(() => {
-            this.confirmLoading = false
-          })
+              this.$message.success('导入结束,请查看结果表格')
+              this.data = result
+              // this.handleCancel(values)
+              this.BaseTool.ListForm.clearOneList(this)
+              this.fileList = []
+              this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          importCheckStandardOldVersion(formData)
+            .then((res) => {
+              // 循环添加到formData中
+              const resultArr = res.data.split(';')
+              const result = []
+              for (let i = 0; i < resultArr.length; i++) {
+                const r = resultArr[i]
+                if (r.indexOf('成功') === 0) {
+                  result.push({ id: i, name: r, status: '成功' })
+                } else if (r.indexOf('失败') === 0) {
+                  result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
+                }
+              }
+              this.$message.success('导入结束,请查看结果表格')
+              this.data = result
+              // this.handleCancel(values)
+              this.BaseTool.ListForm.clearOneList(this)
+              this.fileList = []
+              this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
       })
     },
     handleCancel (values) {