zcy vor 3 Jahren
Ursprung
Commit
877b390e2b

+ 4 - 1
src/mixin/listMixin.js

@@ -50,7 +50,10 @@ export const listMixin = {
     }
   },
   created() {
-    this.loadData()
+    if (this.isNotCreateLoad) {
+    } else {
+      this.loadData()
+    }
   },
   computed: {
     // token header

+ 152 - 0
src/views/security/checkList/CheckAndEditModel.vue

@@ -0,0 +1,152 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="700"
+    :visible="visible"
+    :mask-closable="false"
+    cancel-text="关闭"
+    @close="close"
+  >
+    <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :rules="validatorRules" :model="model">
+      <a-form-model-item label="车间" prop="deptId">
+        <a-tree-select
+          v-model="model.deptId"
+          :show-search="true"
+          allow-clear
+          tree-default-expand-all
+          style="width: 100%"
+          :tree-data="treeData"
+          tree-node-filter-prop="label"
+          :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
+        />
+      </a-form-model-item>
+      <a-form-model-item label="存放处" prop="storePlace">
+        <a-input
+          v-model="model.storePlace"
+        />
+      </a-form-model-item>
+      <a-form-model-item label="工具名称" prop="toolType">
+        <j-dict-select-tag
+          v-model="model.toolType"
+          dict-code="tool_type"
+          @toolChange="toolChange"
+        />
+      </a-form-model-item>
+      <a-form-model-item label="编号" prop="toolCode">
+        <a-input v-model="model.toolCode" />
+      </a-form-model-item>
+      <a-form-model-item label="电压等级" prop="elecLevel">
+        <a-input v-model="model.elecLevel" />
+      </a-form-model-item>
+      <a-form-model-item label="计量单位" prop="unit">
+        <a-input v-model="model.unit" :disabled="true" />
+      </a-form-model-item>
+      <a-form-model-item label="实验周期" prop="testCycle">
+        <j-dict-select-tag v-model="model.testCycle" type="radioButton" dict-code="test_cycle" />
+      </a-form-model-item>
+      <a-form-model-item label="生产厂家" prop="produceFactory">
+        <a-input v-model="model.produceFactory" />
+      </a-form-model-item>
+      <a-form-model-item label="生产日期" prop="produceDate">
+        <a-date-picker
+          v-model="model.produceDate"
+          style="width: 100%"
+          format="YYYY-MM-DD"
+          value-format="YYYY-MM-DD"
+          placeholder="请选择"
+        />
+      </a-form-model-item>
+      <a-form-model-item label="备注" prop="remark">
+        <a-textarea v-model="model.remark" :max-length="300" :rows="4" />
+      </a-form-model-item>
+    </a-form-model>
+  </j-modal>
+</template>
+<script>
+import { httpAction, getAction } from '@/api/request'
+import JModal from '@/components/JModal'
+
+export default {
+  name: 'CheckAndEditModel',
+  components: {
+    JModal
+  },
+  data() {
+    return {
+      treeData: [],
+      labelCol: { span: 4 },
+      wrapperCol: { span: 19 },
+      dataSource: [],
+      title: '',
+      visible: false,
+      isCheck: false,
+      model: {},
+      validatorRules: {
+        deptId: [{ required: true, message: '请选择' }],
+        storePlace: [{ required: true, message: '请输入' }],
+        toolType: [{ required: true, message: '请选择' }],
+        toolCode: [{ required: true, message: '请输入' }],
+        elecLevel: [{ required: true, message: '请输入' }],
+        unit: [{ required: true, message: '请输入' }],
+        testCycle: [{ required: true, message: '请选择' }],
+        produceFactory: [{ required: true, message: '请输入' }],
+        produceDate: [{ required: true, message: '请输入' }],
+        remark: [{ required: true, message: '请输入' }]
+
+      },
+      url: {
+        replace: '/business/safetool/base/safety/tool/replaceTool',
+        tree: '/system/dept/treeSelect'
+      }
+    }
+  },
+  created() {
+    this.loadTree()
+  },
+  methods: {
+    loadTree() {
+      this.treeData = []
+      getAction(this.url.tree).then((res) => {
+        if (res.code === 200) {
+          this.treeData = res.data
+        }
+      })
+    },
+    toolChange(data) {
+      this.model.unit = data
+    },
+    edit(record) {
+      debugger
+      this.model = Object.assign({}, { toolId: record.toolId }, { experimentId: record.experimentId })
+      this.visible = true
+    },
+    close(isSubmit) {
+      if (isSubmit) {
+        this.checkData()
+      } else {
+        this.visible = false
+      }
+    },
+    checkData() {
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          this.saveData()
+        } else {
+          return false
+        }
+      })
+    },
+    saveData() {
+      httpAction(this.url.replace, this.model, 'post').then((res) => {
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+          this.$emit('ok')
+          this.visible = false
+        } else {
+          console.log(res)
+        }
+      })
+    }
+  }
+}
+</script>

+ 11 - 4
src/views/security/checkList/view/dy/index.vue

@@ -51,7 +51,7 @@
       </a-form>
     </div>
     <!-- table区域-begin -->
-    <div>
+    <div style="margin-top: 10px">
       <a-table
         ref="table"
         size="middle"
@@ -62,19 +62,26 @@
         :pagination="ipagination"
         :loading="loading"
         @change="handleTableChange"
-      />
+      >
+        <span slot="action" slot-scope="text, record">
+          <a-button size="small" type="link" @click="handleEdit(record)">
+            完成实验
+          </a-button>
+        </span>
+      </a-table>
     </div>
     <!-- table区域-end -->
     <!-- 表单区域 -->
+    <sy-list ref="modalForm" />
   </div>
 </template>
 <script>
 import { listMixin } from '@/mixin/listMixin'
 import columns from './indexColumns'
 import { getAction } from '@/api/request'
-
+import syList from './syList'
 export default {
-  components: {},
+  components: { syList },
   mixins: [listMixin],
   data() {
     return {

+ 61 - 0
src/views/security/checkList/view/dy/syColumns.js

@@ -0,0 +1,61 @@
+function columns(vm) {
+  const cols = [
+    {
+      title: '序号',
+      key: 'rowIndex',
+      width: 60,
+      align: 'center',
+      customRender: function(t, r, index) {
+        return parseInt(index) + 1
+      }
+    },
+    {
+      title: '编号',
+      align: 'center',
+      dataIndex: 'toolCode',
+      key: 'toolCode'
+    },
+    {
+      title: '工具名称',
+      align: 'center',
+      dataIndex: 'toolName',
+      key: 'toolName'
+    },
+    {
+      title: '车间',
+      align: 'center',
+      dataIndex: 'deptName',
+      key: 'deptName'
+    },
+    {
+      title: '存放处所',
+      align: 'center',
+      dataIndex: 'storePlace',
+      key: 'storePlace'
+    },
+    {
+      title: '上次检验日期',
+      align: 'center',
+      dataIndex: 'lastTestDate',
+      key: 'lastTestDate'
+    },
+    {
+      title: '结果',
+      align: 'center',
+      dataIndex: 'isok',
+      scopedSlots: { customRender: 'isok' },
+      key: 'isok'
+    },
+    {
+      title: '操作',
+      dataIndex: 'action',
+      width: 150,
+      align: 'center',
+      slots: { title: 'actionName' },
+      scopedSlots: { customRender: 'action' }
+    }
+  ]
+  return cols
+}
+
+export default columns

+ 188 - 0
src/views/security/checkList/view/dy/syList.vue

@@ -0,0 +1,188 @@
+<template>
+  <div>
+    <j-modal
+      :title="title"
+      width="70%"
+      :visible="visible"
+      :mask-closable="false"
+      cancel-text="关闭"
+      @close="close"
+    >
+      <!-- 操作按钮区域 -->
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="searchQuery">
+          <a-form-item>
+            <j-dict-select-tag
+              v-model="queryParam.toolType"
+              style="width: 150px"
+              placeholder="选择工具名称"
+              dict-code="tool_type"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-tree-select
+              v-model="queryParam.deptId"
+              style="width: 150px"
+              :show-search="true"
+              allow-clear
+              placeholder="选择车间"
+              :tree-data="treeData"
+              tree-node-filter-prop="label"
+              :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-input
+              v-model="queryParam.storePlace"
+              style="width: 150px"
+              placeholder="输入存放处"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-date-picker
+              v-model="queryParam.lastTestDate"
+              format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD"
+              placeholder="上次检验日期"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-input
+              v-model="queryParam.toolCode"
+              style="width: 150px"
+              placeholder="输入编号"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-button type="primary" @click="searchQuery">查询</a-button>
+            <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
+          </a-form-item>
+        </a-form>
+      </div>
+
+      <!-- table区域-begin -->
+      <div style="margin-top: 10px">
+        <a-table
+          ref="table"
+          size="middle"
+          bordered
+          row-key="toolId"
+          :columns="columns"
+          :data-source="dataSource"
+          :pagination="ipagination"
+          :loading="loading"
+          @change="handleTableChange"
+        >
+          <template slot="isok" slot-scope="text, record">
+            <a-switch
+              :checked="record.isok==='1'?true:false"
+              checked-children="合格"
+              un-checked-children="不合格"
+              @change="changeStatus({$event,record})"
+            />
+          </template>
+          <span slot="action" slot-scope="text, record">
+            <a-button v-if="record.isok!=='1'" size="small" type="primary" @click="handleEdit1(record)">
+              更换工具
+            </a-button>
+          </span>
+        </a-table>
+      </div>
+    <!-- table区域-end -->
+    <!-- 表单区域 -->
+    </j-modal>
+    <check-and-edit-model ref="changeModel" @ok="modalFormOk" />
+  </div>
+</template>
+<script>
+import { listMixin } from '@/mixin/listMixin'
+import { getAction, httpAction } from '@/api/request'
+import JModal from '@/components/JModal'
+import columns from './syColumns'
+import CheckAndEditModel from '../../CheckAndEditModel'
+
+export default {
+  name: 'SyList',
+  components: {
+    CheckAndEditModel,
+    JModal
+  },
+  mixins: [listMixin],
+  data() {
+    return {
+      title: '完成试验',
+      visible: false,
+      queryParam: {},
+      // 表头
+      isNotCreateLoad: true,
+      columns: columns(this),
+      treeData: [],
+      id: '',
+      url: {
+        list: '/business/safetool/base/safety/tool/listExperimentTool',
+        tree: '/system/dept/treeSelect'
+      }
+
+    }
+  },
+  created() {
+  },
+  methods: {
+    handleEdit1: function(record) {
+      this.$refs.changeModel.edit(record)
+      this.$refs.changeModel.title = '更换安全工具'
+      this.$refs.changeModel.disableSubmit = false
+    },
+    edit(record) {
+      this.id = record.id
+      this.loadData()
+      this.visible = true
+    },
+    changeStatus({ $event, record }) {
+      console.log($event, record)
+      record.isok = $event ? '1' : '0'
+      httpAction('/business/safetool/sec/experiment/setToolNQ', record, 'post').then((res) => {
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+        } else {
+          console.log(res)
+        }
+      })
+    },
+    loadData() {
+      if (!this.url.list) {
+        this.$message.error('请设置url.list属性!')
+        return
+      }
+      var params = this.getQueryParams()// 查询条件
+      this.queryParam = Object.assign({}, params, { id: this.id })
+      this.loading = true
+      getAction(this.url.list, params).then((res) => {
+        if (res.code === 200) {
+          this.dataSource = res.rows || res.data
+          if (res.total) {
+            this.ipagination.total = res.total
+          } else {
+            this.ipagination.total = 0
+          }
+        } else {
+          this.$message.warning(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    loadTree() {
+      this.treeData = []
+      getAction(this.url.tree).then((res) => {
+        if (res.code === 200) {
+          this.treeData = res.data
+        }
+      })
+    },
+    close() {
+      this.visible = false
+    }
+  }
+}
+</script>

+ 11 - 4
src/views/security/checkList/view/yy/index.vue

@@ -51,7 +51,7 @@
       </a-form>
     </div>
     <!-- table区域-begin -->
-    <div>
+    <div style="margin-top: 10px">
       <a-table
         ref="table"
         size="middle"
@@ -62,19 +62,26 @@
         :pagination="ipagination"
         :loading="loading"
         @change="handleTableChange"
-      />
+      >
+        <span slot="action" slot-scope="text, record">
+          <a-button size="small" type="link" @click="handleEdit(record)">
+            查看结果
+          </a-button>
+        </span>
+      </a-table>
     </div>
     <!-- table区域-end -->
     <!-- 表单区域 -->
+    <sy-list ref="modalForm" />
   </div>
 </template>
 <script>
 import { listMixin } from '@/mixin/listMixin'
 import columns from './indexColumns'
 import { getAction } from '@/api/request'
-
+import syList from './syList'
 export default {
-  components: {},
+  components: { syList },
   mixins: [listMixin],
   data() {
     return {

+ 53 - 0
src/views/security/checkList/view/yy/syColumns.js

@@ -0,0 +1,53 @@
+function columns(vm) {
+  const cols = [
+    {
+      title: '序号',
+      key: 'rowIndex',
+      width: 60,
+      align: 'center',
+      customRender: function(t, r, index) {
+        return parseInt(index) + 1
+      }
+    },
+    {
+      title: '编号',
+      align: 'center',
+      dataIndex: 'toolCode',
+      key: 'toolCode'
+    },
+    {
+      title: '工具名称',
+      align: 'center',
+      dataIndex: 'toolName',
+      key: 'toolName'
+    },
+    {
+      title: '车间',
+      align: 'center',
+      dataIndex: 'deptName',
+      key: 'deptName'
+    },
+    {
+      title: '存放处所',
+      align: 'center',
+      dataIndex: 'storePlace',
+      key: 'storePlace'
+    },
+    {
+      title: '上次检验日期',
+      align: 'center',
+      dataIndex: 'lastTestDate',
+      key: 'lastTestDate'
+    },
+    {
+      title: '结果',
+      align: 'center',
+      dataIndex: 'isok',
+      scopedSlots: { customRender: 'isok' },
+      key: 'isok'
+    }
+  ]
+  return cols
+}
+
+export default columns

+ 160 - 0
src/views/security/checkList/view/yy/syList.vue

@@ -0,0 +1,160 @@
+<template>
+  <div>
+    <j-modal
+      :title="title"
+      width="70%"
+      :visible="visible"
+      :mask-closable="false"
+      cancel-text="关闭"
+      @close="close"
+    >
+      <!-- 操作按钮区域 -->
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="searchQuery">
+          <a-form-item>
+            <j-dict-select-tag
+              v-model="queryParam.toolType"
+              style="width: 150px"
+              placeholder="选择工具名称"
+              dict-code="tool_type"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-tree-select
+              v-model="queryParam.deptId"
+              style="width: 150px"
+              :show-search="true"
+              allow-clear
+              placeholder="选择车间"
+              :tree-data="treeData"
+              tree-node-filter-prop="label"
+              :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-input
+              v-model="queryParam.storePlace"
+              style="width: 150px"
+              placeholder="输入存放处"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-date-picker
+              v-model="queryParam.lastTestDate"
+              format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD"
+              placeholder="上次检验日期"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-input
+              v-model="queryParam.toolCode"
+              style="width: 150px"
+              placeholder="输入编号"
+            />
+          </a-form-item>
+          <a-form-item>
+            <a-button type="primary" @click="searchQuery">查询</a-button>
+            <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
+          </a-form-item>
+        </a-form>
+      </div>
+
+      <!-- table区域-begin -->
+      <div style="margin-top: 10px">
+        <a-table
+          ref="table"
+          size="middle"
+          bordered
+          row-key="toolId"
+          :columns="columns"
+          :data-source="dataSource"
+          :pagination="ipagination"
+          :loading="loading"
+          @change="handleTableChange"
+        >
+          <template slot="isok" slot-scope="text, record">
+            <span>{{ record.isok==='1'?'合格':'不合格' }}</span>
+          </template>
+        </a-table>
+      </div>
+    <!-- table区域-end -->
+    <!-- 表单区域 -->
+    </j-modal>
+  </div>
+</template>
+<script>
+import { listMixin } from '@/mixin/listMixin'
+import { getAction, httpAction } from '@/api/request'
+import JModal from '@/components/JModal'
+import columns from './syColumns'
+import CheckAndEditModel from '../../CheckAndEditModel'
+
+export default {
+  name: 'SyList',
+  components: {
+    JModal
+  },
+  mixins: [listMixin],
+  data() {
+    return {
+      title: '完成试验',
+      visible: false,
+      queryParam: {},
+      // 表头
+      isNotCreateLoad: true,
+      columns: columns(this),
+      treeData: [],
+      id: '',
+      url: {
+        list: '/business/safetool/base/safety/tool/listExperimentTool',
+        tree: '/system/dept/treeSelect'
+      }
+
+    }
+  },
+  created() {
+  },
+  methods: {
+    edit(record) {
+      this.id = record.id
+      this.loadData()
+      this.visible = true
+    },
+    loadData() {
+      if (!this.url.list) {
+        this.$message.error('请设置url.list属性!')
+        return
+      }
+      var params = this.getQueryParams()// 查询条件
+      this.queryParam = Object.assign({}, params, { id: this.id })
+      this.loading = true
+      getAction(this.url.list, params).then((res) => {
+        if (res.code === 200) {
+          this.dataSource = res.rows || res.data
+          if (res.total) {
+            this.ipagination.total = res.total
+          } else {
+            this.ipagination.total = 0
+          }
+        } else {
+          this.$message.warning(res.msg)
+        }
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    loadTree() {
+      this.treeData = []
+      getAction(this.url.tree).then((res) => {
+        if (res.code === 200) {
+          this.treeData = res.data
+        }
+      })
+    },
+    close() {
+      this.visible = false
+    }
+  }
+}
+</script>

+ 1 - 0
src/views/security/stand/CheckAndEditModel.vue

@@ -121,6 +121,7 @@ export default {
       this.visible = true
     },
     edit(record) {
+      debugger
       this.model = Object.assign({}, record)
       this.visible = true
     },

+ 41 - 19
src/views/security/stand/bfList.vue

@@ -7,6 +7,10 @@
     cancel-text="关闭"
     @close="close"
   >
+    <!-- 操作按钮区域 -->
+    <div class="table-operator" style="float: right">
+      <a-button ghost type="danger" @click="handleExportXls()">导出数据</a-button>
+    </div>
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-form-item>
@@ -33,10 +37,17 @@
           <a-input
             v-model="queryParam.storePlace"
             style="width: 150px"
-            placeholder="选择存放处"
+            placeholder="输入存放处"
+          />
+        </a-form-item>
+        <a-form-item>
+          <a-date-picker
+            v-model="queryParam.lastTestDate"
+            format="YYYY-MM-DD"
+            value-format="YYYY-MM-DD"
+            placeholder="上次检验日期"
           />
         </a-form-item>
-        <a-form-item />
         <a-form-item>
           <a-input
             v-model="queryParam.toolCode"
@@ -50,12 +61,9 @@
         </a-form-item>
       </a-form>
     </div>
-    <!-- 操作按钮区域 -->
-    <div class="table-operator" style="margin: 15px 0">
-      <a-button ghost type="danger" @click="handleExportXls()">导出数据</a-button>
-    </div>
+
     <!-- table区域-begin -->
-    <div>
+    <div style="margin-top: 10px">
       <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
         <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
           selectedRowKeys.length }}</a>项&nbsp;&nbsp;
@@ -74,15 +82,19 @@
         @change="handleTableChange"
       >
         <span slot="action" slot-scope="text, record">
-          <!--          <a-button size="small" type="primary" @click="handleEdit(record)">-->
-          <!--            编辑-->
-          <!--          </a-button>-->
-          <!--          <a-divider type="vertical" />-->
+          <a-button v-if="record.isok!=='1'" size="small" type="primary" @click="handleEdit(record)">
+            更换工具
+          </a-button>
+          <a-button v-else size="small" type="primary" @click="handleCheck(record)">
+            查看替换工具
+          </a-button>
         </span>
       </a-table>
     </div>
     <!-- table区域-end -->
     <!-- 表单区域 -->
+    <check-model ref="checkForm" />
+    <change-model ref="changeModel" />
   </j-modal>
 </template>
 <script>
@@ -90,11 +102,15 @@ import { getAction, downFile } from '@/api/request'
 import JModal from '@/components/JModal'
 import { listMixin } from '@/mixin/listMixin'
 import columns from './indexColumns'
+import CheckModel from './CheckAndEditModel'
+import ChangeModel from '../checkList/CheckAndEditModel'
 
 export default {
-  name: 'CheckAndEditModel',
+  name: 'BfList',
   components: {
-    JModal
+    JModal,
+    CheckModel,
+    ChangeModel
   },
   mixins: [listMixin],
   data() {
@@ -129,13 +145,19 @@ export default {
         }
       })
     },
-    edit(record) {
+    handleCheck: function(record) {
+      this.$refs.checkForm.edit(record)
+      this.$refs.checkForm.title = '查看'
+      this.$refs.checkForm.disableSubmit = true
     },
-    close(isSubmit) {
-      if (isSubmit) {
-      } else {
-        this.visible = false
-      }
+    handleEdit: function(record) {
+      this.$refs.changeModel.edit(record)
+      this.$refs.changeModel.title = '更换安全工具'
+      this.$refs.changeModel.disableSubmit = false
+    },
+
+    close() {
+      this.visible = false
     }
   }
 }