whj vor 1 Jahr
Ursprung
Commit
dfb1dbd79d

+ 17 - 1
src/api/sb/info.js

@@ -175,7 +175,23 @@ export function addSbInfo (parameter) {
     data: parameter
   })
 }
-
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function SyncSbBom (parameter) {
+  return axios({
+    url: '/sb/model-spare-boms/synchronous/add',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
 /**
  * add func
  * parameter: { }

+ 17 - 2
src/views/preparation/preparation/Preparation.vue

@@ -59,6 +59,8 @@
             >修改</operation-button>-->
             <a-divider v-if="record.status === 1" type="vertical" />
             <a v-if="record.status === 1" @click="handleAssign(record)">派单</a>
+            <a-divider type="vertical" />
+            <a @click="handlePrint(record)">打印</a>
           </template>
         </span>
         <span slot="status" slot-scope="text">
@@ -69,6 +71,8 @@
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
     <assign-form ref="assignForm" @ok="handleOk" />
+    <ticket-form ref="ticketForm" @ok="handleOk" />
+
   </a-card>
 </template>
 
@@ -78,6 +82,8 @@ import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
 import { getPreparationPage, deletePreparations, fetchPreparation, exportPreparation } from '@/api/preparation/preparation'
 import AssignForm from './modules/AssignForm'
+import TicketForm from './modules/TicketForm'
+
 export default {
   name: 'PreparationList',
   components: {
@@ -85,7 +91,8 @@ export default {
     Ellipsis,
     BaseForm,
     Detail,
-    AssignForm
+    AssignForm,
+    TicketForm
   },
   props: {
     searchType: {
@@ -96,7 +103,7 @@ export default {
   data () {
     return {
       advanced: false,
-      visible: true,
+      visible: false,
       statusMap: {},
       preparationMap: {},
       // 查询参数
@@ -295,6 +302,14 @@ export default {
         const modal = this.$refs.assignForm
         modal.base(res.data)
       })
+    },
+    handlePrint (record) {
+      this.visible = false
+      console.log(record)
+      // fetchOutStoreForm({ id: record.id }).then(res => {
+      const modal = this.$refs.ticketForm
+      modal.base(record)
+      // })
     }
   }
 }

+ 170 - 0
src/views/preparation/preparation/modules/TicketForm.vue

@@ -0,0 +1,170 @@
+<template>
+  <div class="main" v-show="visible">
+    <div>
+      <a-button type="primary" v-print="'#print-container2'" :disabled="disabled">打印</a-button>
+      <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+    </div>
+    <div id="print-container2">
+      <div class="title">
+        <div style="font-size:26px;"><span style="font-size:30px;font-weight:700;vertical-align: middle;letter-spacing:.2em;">工作联络单</span></div>
+      </div>
+      <div style="display:flex;justify-content:space-between; margin: 10px auto;width: 830px;">
+        <div>申请人:{{ model.userName }}</div>
+        <div>申请部门:{{ model.userName }}</div>
+        <div>日期:{{ model.userName }}</div>
+        <div>单号:{{ model.userName }}</div>
+      </div>
+      <div class="tables" >
+        <table>
+          <tr>
+            <td colspan="2" style="text-align:left;">
+              公司:{{ model.userName }}
+            </td>
+            <td colspan="2" style="text-align:left;">
+              收件部门:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2" style="text-align:left;">
+              任务名称:{{ model.userName }}
+            </td>
+            <td colspan="2" style="text-align:left;">
+              要求完成:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="4" style="text-align:left;">
+              任务内容:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="4" style="text-align:left;">
+              申请原因:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="1" style="text-align:left;">
+              承办人:{{ model.userName }}
+            </td>
+            <td colspan="1" style="text-align:left;">
+              承办部门:{{ model.userName }}
+            </td>
+            <td colspan="1" style="text-align:left;">
+              处理日期:{{ model.userName }}
+            </td>
+            <td colspan="1" style="text-align:left;">
+              费用预算:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="4" style="text-align:left;">
+              费用计算表:{{ model.userName }}
+            </td>
+          </tr>
+          <tr>
+            <td colspan="4" style="text-align:left;">
+              处理人意见区: <br />
+              <br />
+              <div style="padding-left:30px;">
+                <a-steps :current="2" direction="vertical">
+                  <a-step title="Finished" :sub-title="2" description="This is a description. This is a description." />
+                  <a-step title="In Progress" description="This is a description. This is a description." />
+                  <a-step title="Waiting" description="This is a description." />
+                  <a-step title="Waiting" description="This is a description." />
+                </a-steps>
+              </div>
+            </td>
+          </tr>
+        </table>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data () {
+    return {
+      visible: true,
+      disabled: false,
+      value1: 1,
+      type: true,
+      typeMap: {},
+      deptYYMap: {},
+      model: {
+        userName: 2
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    // this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_TYPE)
+    this.deptYYMap = { ...this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_DEPT_CODE), ...this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBB) }
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      console.log(record)
+      this.model = record
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.$emit('ok')
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.main{
+  background: #fff;
+  font-size: 16px;
+}
+.title{
+  text-align: center;
+  font-size:18px;
+}
+.tables{
+  margin: 10px auto;
+   width: 830px;
+  font-size: 16px;
+  overflow-x:auto;
+  table {
+        margin: 0 auto;
+        border: 1px solid #D6D6D6;
+        border-radius: 6px;
+   width: 830px;
+        border-collapse: collapse;
+        font-weight: 400;
+    }
+    th{
+      color: #FFFFFF;
+      background: #3762FC;
+    }
+    tr {
+      min-height:26px;
+    }
+    th,
+    td {
+        border: 1px solid #D6D6D6;
+        text-align: center;
+        padding: 2px 10px;
+        word-wrap:break-word;
+        word-break:break-all;
+    }
+}
+.check{
+  position:absolute;
+  left:0px;
+  font-size:20px;
+}
+.checks{
+  position:absolute;
+  left:-27px;
+  font-size:20px;
+}
+/deep/.ant-radio-inner::after ,/deep/.ant-checkbox-checked .ant-checkbox-inner{
+  background-color:#fff;
+  border-radius: 0;
+}
+</style>

+ 10 - 1
src/views/sb/info/SbInfo.vue

@@ -240,6 +240,9 @@
                         <a-menu-item key="4">
                           <a @click="handlePrint(record)">打印</a>
                         </a-menu-item>
+                        <a-menu-item key="5">
+                          <a @click="handleSync(record)">同步</a>
+                        </a-menu-item>
                       </a-menu>
                       <a-button> 操作 <a-icon type="down" /> </a-button>
                     </a-dropdown>
@@ -276,12 +279,14 @@
     <base-form-measure-in-store ref="baseModalMeasureInStore" @ok="handleOk"/>
     <base-form-location ref="baseFormLocation" @ok="handleOk" />
     <SbChangeLogSelectModal ref="sbChangeRecordSelectModal" @ok="handleOk" />
+    <SbBomSyncSelectModal type="checkbox" ref="sbBomSyncSelectModal" @ok="handleOk" />
   </div>
 </template>
 
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+import SbBomSyncSelectModal from './modules/SbBomSyncSelectModal'
 import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
 import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
 import Detail from './modules/Detail'
@@ -320,7 +325,8 @@ export default {
     BaseFormMeasureInStore,
     BaseFormLocation,
     BaseFormStatusLog,
-    SbChangeLogSelectModal
+    SbChangeLogSelectModal,
+    SbBomSyncSelectModal
   },
   props: {
     filter: {
@@ -957,6 +963,9 @@ export default {
       } else {
         this.typeList = [value]
       }
+    },
+    handleSync (record) {
+      this.$refs.sbBomSyncSelectModal.base(null, { sbId: record.id })
     }
   }
 }

+ 378 - 0
src/views/sb/info/modules/SbBomSyncSelectModal.vue

@@ -0,0 +1,378 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1300"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/设备型号"/>
+              </a-form-item>
+            </a-col>
+            <!--            <a-col :md="8" :sm="24">
+              <a-form-item label="上层设备类型">
+                <a-tree-select
+                  style="width: 100%"
+                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                  :treeData="treeData"
+                  :treeNodeFilterProp="'title'"
+                  :showSearch="true"
+                  v-model="queryParam.parentId"
+                  placeholder="请选择"
+                >
+                </a-tree-select>
+              </a-form-item>
+            </a-col>-->
+            <a-col :md="6" :sm="24">
+              <a-form-item label="车间位置">
+                <a-select v-model="queryParam.positionId" placeholder="请选择">
+                  <a-select-option
+                    v-for="({id,name}) in sbPositionData"
+                    :key="id"
+                    :label="name"
+                    :value="id">{{ name }}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <!-- <a-col :md="6" :sm="24">
+              <a-form-item label="设备类型">
+                <a-tree-select
+                  style="width: 100%"
+                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                  :treeData="treeData"
+                  :treeNodeFilterProp="'title'"
+                  :showSearch="true"
+                  placeholder="请选择"
+                  @change="handleChange"
+                >
+                </a-tree-select>
+              </a-form-item>
+            </a-col> -->
+            <a-col :md="8 || 24" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator" style="margin-bottom: 8px;">
+        覆盖类型:  <a-select v-model="cover" placeholder="请选择">
+          <a-select-option
+            label="新增覆盖"
+            :value="false">新增覆盖
+          </a-select-option>
+          <a-select-option
+            label="删除覆盖"
+            :value="true">删除覆盖
+          </a-select-option>
+        </a-select>
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :customRow="options.customRow"
+        :rowSelection="options.rowSelection"
+        :scroll="{ x: 1300, y: BaseTool.Constant.scrollY }"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <template>
+
+          </template>
+        </span>
+        <span slot="status" slot-scope="text">
+          <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
+        </span>
+      </s-table>
+    </a-card>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">同步</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import { getSbInfoSyncPage, SyncSbBom, getSbInfoTree } from '@/api/sb/info'
+import { querySbPosition } from '@/api/sb/position'
+import { fetchSbTypeTree } from '@/api/sb/type'
+
+export default {
+  name: 'SbInfoSelectModal',
+  components: {
+    STable,
+    Ellipsis
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 查询参数
+      queryParam: {
+      },
+      cover: false,
+      extraQueryParam: {
+      },
+      depreciationTypeMap: {},
+      levelMap: {},
+      statusMap: {},
+      unitMap: {},
+      useTypeMap: {},
+      sourceTypeMap: {},
+      treeData: [],
+      sbPositionData: [],
+      typeList: [],
+      // 表头
+      columns: [
+        {
+          title: '设备名称',
+          checked: true,
+          dataIndex: 'name'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          checked: true
+        },
+        {
+          title: '设备位号',
+          checked: true,
+          dataIndex: 'positionNo'
+        },
+        {
+          title: '型号',
+          checked: true,
+          dataIndex: 'model'
+        },
+        {
+          title: '设备类型',
+          dataIndex: 'type',
+          checked: true,
+          width: 200,
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
+        {
+          title: '设备等级',
+          dataIndex: 'level',
+          checked: true,
+          width: 200,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          checked: true,
+          width: 200,
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark',
+          width: 200
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          fixed: 'right',
+          scopedSlots: { width: 200, customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          typeList: this.typeList,
+          dataScope: {
+            sortBy: 'asc',
+            sortName: 'no'
+          }
+        }
+        return getSbInfoSyncPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: true,
+      isCreated: false,
+      record: {}
+    }
+  },
+  created () {
+    this.tableOption()
+    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
+    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_UES_TYPE)
+    querySbPosition().then(res => {
+      this.sbPositionData = res.data
+    })
+    fetchSbTypeTree().then(res => {
+      this.treeData = res.data
+    })
+  },
+  methods: {
+    tableOption () {
+      // this.setTree()
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleOk () {
+      // this.setTree()
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    /**
+     * 设置设备类型树
+     */
+    base (record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择设备'
+      this.queryParam = queryParam
+      this.record = record
+      if (this.isCreated) {
+        console.log(this.$refs.table)
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+      // this.mySelect(this.selectedRowKeys, this.selectedRows)
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        SyncSbBom({
+          sbIds: this.selectedRowKeys,
+          sbId: this.queryParam.sbId,
+          cover: this.cover
+        }).then(res => {
+          this.$message.success('同步成功!')
+          this.$emit('ok')
+          this.confirmLoading = false
+          this.visible = false
+        })
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+    },
+    handleChange (value, label, extra) {
+      const data = this.treeData.find(item => item.id === value)
+      if (data && data.children && data.children.length > 0) {
+        this.typeList = data.children.map(item => item.id)
+      } else {
+        this.typeList = [value]
+      }
+    }
+  }
+}
+</script>