You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1640 lines
57 KiB

1 week ago
2 weeks ago
5 days ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 条件查询 -->
  4. <el-form :inline="true" label-position="top" :model="searchData">
  5. <!-- <el-form-item label="BU">
  6. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
  7. <el-option
  8. v-for = "i in userBuList"
  9. :key = "i.buNo"
  10. :label = "i.buDesc"
  11. :value = "i.buDesc">
  12. </el-option>
  13. </el-select>
  14. </el-form-item> -->
  15. <el-form-item label="项目编码">
  16. <el-input v-model="searchData.itemNo" clearable style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item label="项目名称">
  19. <el-input v-model="searchData.itemDesc" clearable style="width: 200px"></el-input>
  20. </el-form-item>
  21. <el-form-item label="检验类型">
  22. <el-select v-model="searchData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择" style="width: 100px">
  23. <el-option v-if="!lineInspectionRoleFlag" label="全部" value=""></el-option>
  24. <el-option
  25. v-for = "i in options"
  26. :key = "i.inspectionTypeNo"
  27. :label = "i.inspectionTypeName"
  28. :value = "i.inspectionTypeNo">
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label=" ">
  33. <el-button v-if="authSearch" type="primary" @click="getDataList()">查询</el-button>
  34. <el-button v-if="authSave" type="primary" @click="addModal()">新增</el-button>
  35. </el-form-item>
  36. <el-form-item label=" ">
  37. <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
  38. <download-excel
  39. :fields="fields()"
  40. :data="exportData"
  41. type="xls"
  42. :name="exportName"
  43. :header="exportHeader"
  44. :footer="exportFooter"
  45. :fetch="createExportData"
  46. :before-generate="startDownload"
  47. :before-finish="finishDownload"
  48. worksheet="导出信息"
  49. class="el-button el-button--primary el-button--medium">
  50. {{ "导出" }}
  51. </download-excel>
  52. </el-form-item>
  53. </el-form>
  54. <!-- 展示列表 -->
  55. <el-table
  56. :height="height"
  57. :data="dataList"
  58. border
  59. style="width: 100%;">
  60. <el-table-column
  61. v-for="(item,index) in columnList" :key="index"
  62. :sortable="item.columnSortable"
  63. :prop="item.columnProp"
  64. :header-align="item.headerAlign"
  65. :show-overflow-tooltip="item.showOverflowTooltip"
  66. :align="item.align"
  67. :fixed="item.fixed == '' ? false : item.fixed"
  68. :min-width="item.columnWidth"
  69. :label="item.columnLabel">
  70. <template slot-scope="scope">
  71. <span v-if="!item.columnHidden">
  72. <span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span>
  73. <span v-else>
  74. {{ scope.row[item.columnProp] }}
  75. </span>
  76. </span>
  77. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. fixed="right"
  82. header-align="center"
  83. align="center"
  84. width="160"
  85. label="操作">
  86. <template slot-scope="scope">
  87. <a v-if="authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  88. <a v-if="authDelete" type="text" size="small" @click="deleteModal(scope.row)">删除</a>
  89. <!-- <a type="text" size="small" @click="itemObjectModal(scope.row)">采集设备配置</a> -->
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <el-pagination
  94. @size-change="sizeChangeHandle"
  95. @current-change="currentChangeHandle"
  96. :current-page="pageIndex"
  97. :page-sizes="[20, 50, 100, 200, 500]"
  98. :page-size="pageSize"
  99. :total="totalPage"
  100. layout="total, sizes, prev, pager, next, jumper">
  101. </el-pagination>
  102. <!-- 新增和修改 -->
  103. <el-dialog title="检验项目" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="500px">
  104. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  105. <!-- <el-form-item label="BU" prop="bu" :rules="rules.bu">
  106. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" @change="buChangeFunction" style="width: 456px">
  107. <el-option
  108. v-for = "i in userBuList"
  109. :key = "i.buNo"
  110. :label = "i.sitename"
  111. :value = "i.buNo">
  112. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  113. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  114. {{ i.buDesc }}
  115. </span>
  116. </el-option>
  117. </el-select>
  118. </el-form-item> -->
  119. </el-form>
  120. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  121. <el-form-item label="项目名称" prop="itemDesc" :rules="rules.itemDescType">
  122. <el-input v-model="modalData.itemDesc" style="width: 143px"></el-input>
  123. </el-form-item>
  124. <el-form-item label="检验值类型" prop="valueTypeDb" :rules="rules.valueTypeDbType">
  125. <el-select filterable v-model="modalData.valueTypeDb" style="width: 143px">
  126. <el-option label="文本" value="T"></el-option>
  127. <el-option label="数字" value="N"></el-option>
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item label="检验类型" prop="inspectionTypeNo" :rules="rules.inspectionTypeNoType">
  131. <el-select v-model="modalData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择" style="width: 143px">
  132. <el-option
  133. v-for = "i in options"
  134. :key = "i.inspectionTypeNo"
  135. :label = "i.inspectionTypeName"
  136. :value = "i.inspectionTypeNo">
  137. </el-option>
  138. </el-select>
  139. </el-form-item>
  140. </el-form>
  141. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  142. <el-form-item prop="methodNo" :rules="rules.methodNoType">
  143. <span slot="label" @click="queryMethodList"><a>方法编码</a></span>
  144. <el-input v-model="modalData.methodNo" style="width: 143px"></el-input>
  145. </el-form-item>
  146. <el-form-item label="方法名称" prop="methodName" :rules="rules.methodNameType">
  147. <el-input v-model="modalData.methodName" disabled style="width: 300px"></el-input>
  148. </el-form-item>
  149. </el-form>
  150. <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  151. <el-form-item>
  152. <span slot="label" @click="getBaseList(207)"><a herf="#">抽样方案编码</a></span>
  153. <el-input v-model="modalData.samplingProgrammeNo" style="width: 143px"></el-input>
  154. </el-form-item>
  155. <el-form-item label="抽样方案名称">
  156. <el-input v-model="modalData.samplingProgrammeDesc" disabled style="width: 300px"></el-input>
  157. </el-form-item>
  158. </el-form>
  159. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  160. <el-form-item>
  161. <span slot="label" @click="getBaseList(208)"><a herf="#">检验水平编码</a></span>
  162. <el-input v-model="modalData.samplingLevelNo" style="width: 143px"></el-input>
  163. </el-form-item>
  164. <el-form-item label="检验水平名称">
  165. <el-input v-model="modalData.samplingLevelDesc" disabled style="width: 300px"></el-input>
  166. </el-form-item>
  167. </el-form> -->
  168. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  169. <el-form-item label="参照值">
  170. <el-input v-model="modalData.defaultValue" style="width: 143px"></el-input>
  171. </el-form-item>
  172. <el-form-item label="最大值">
  173. <el-input v-if="modalData.valueTypeDb === 'T'" v-model="modalData.maxValue" type="number" disabled style="width: 143px"></el-input>
  174. <el-input v-if="modalData.valueTypeDb === 'N'" v-model="modalData.maxValue" type="number" style="width: 143px"></el-input>
  175. </el-form-item>
  176. <el-form-item label="最小值">
  177. <el-input v-if="modalData.valueTypeDb === 'T'" v-model="modalData.minValue" type="number" disabled style="width: 143px"></el-input>
  178. <el-input v-if="modalData.valueTypeDb === 'N'" v-model="modalData.minValue" type="number" style="width: 143px"></el-input>
  179. </el-form-item>
  180. </el-form>
  181. <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">-->
  182. <!-- <el-form-item label="抽样数量">-->
  183. <!-- <el-input v-model="modalData.itemSamplingQuantity" type="number" style="width: 143px"></el-input>-->
  184. <!-- </el-form-item>-->
  185. <!-- <el-form-item label="抽样比例%">-->
  186. <!-- <el-input v-model="modalData.defaultSamplingProportion" type="number" style="width: 143px"></el-input>-->
  187. <!-- </el-form-item>-->
  188. <!-- </el-form>-->
  189. <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  190. <el-form-item label="采集数据来源">
  191. <el-select multiple collapse-tags v-model="modalData.collectionSourceList" style="width: 220px">
  192. <el-option label="采集数据01" value="value0"></el-option>
  193. <el-option label="采集数据02" value="value1"></el-option>
  194. <el-option label="采集数据03" value="value2"></el-option>
  195. <el-option label="采集数据04" value="value3"></el-option>
  196. <el-option label="采集数据05" value="value4"></el-option>
  197. <el-option label="采集数据06" value="value5"></el-option>
  198. <el-option label="采集数据07" value="value6"></el-option>
  199. <el-option label="采集数据08" value="value7"></el-option>
  200. <el-option label="采集数据09" value="value8"></el-option>
  201. <el-option label="采集数据10" value="value9"></el-option>
  202. <el-option label="图片采集" value="photo_value1"></el-option>
  203. <el-option label="文件采集" value="file_value1"></el-option>
  204. </el-select>
  205. </el-form-item>
  206. <el-form-item label="采集数据方式">
  207. <el-select multiple collapse-tags v-model="modalData.collectionMethodList" style="width: 220px">
  208. <el-option label="PLC数据" value="plc"></el-option>
  209. <el-option label="RS232" value="RS232"></el-option>
  210. <el-option label="文件数据" value="file"></el-option>
  211. <el-option label="图片路径" value="image"></el-option>
  212. <el-option label="文件路径" value="fileUrl"></el-option>
  213. <el-option label="胶厚采集" value="thickness"></el-option>
  214. </el-select>
  215. </el-form-item>
  216. </el-form> -->
  217. <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  218. <el-form-item label="采集数据内容">
  219. <el-select v-model="modalData.collectionDataContent" clearable style="width: 456px">
  220. <el-option
  221. v-for = "i in dataContentList"
  222. :key = "i.contentDesc"
  223. :label = "i.contentDesc"
  224. :value = "i.contentDesc">
  225. </el-option>
  226. </el-select>
  227. </el-form-item>
  228. </el-form> -->
  229. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  230. <el-button type="primary" @click="saveData()">保存</el-button>
  231. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  232. </el-footer>
  233. </el-dialog>
  234. <!-- 检验方法 -->
  235. <el-dialog title="检验方法清单" :close-on-click-modal="false" v-drag :visible.sync="methodModelFlag" width="520px">
  236. <div class="rq">
  237. <el-form :inline="true" label-position="top" :model="methodData">
  238. <el-form-item :label="'方法编码'">
  239. <el-input v-model="methodData.methodNo" clearable style="width: 120px"></el-input>
  240. </el-form-item>
  241. <el-form-item :label="'方法名称'">
  242. <el-input v-model="methodData.methodName" clearable style="width: 120px"></el-input>
  243. </el-form-item>
  244. <!-- <el-form-item :label="'检验类型'">-->
  245. <!-- <el-select v-model="methodData.inspectionTypeNo" style="width: 100px">-->
  246. <!-- <el-option-->
  247. <!-- v-for = "i in options"-->
  248. <!-- :key = "i.inspectionTypeNo"-->
  249. <!-- :label = "i.inspectionTypeName"-->
  250. <!-- :value = "i.inspectionTypeNo">-->
  251. <!-- </el-option>-->
  252. <!-- </el-select>-->
  253. <!-- </el-form-item>-->
  254. <el-form-item :label="' '">
  255. <el-button type="primary" @click="queryMethodList">查询</el-button>
  256. </el-form-item>
  257. </el-form>
  258. <el-table
  259. :height="300"
  260. :data="methodList"
  261. @row-dblclick="getRowData"
  262. border
  263. style="width: 100%;">
  264. <el-table-column
  265. v-for="(item,index) in methodDetailList" :key="index"
  266. :sortable="item.columnSortable"
  267. :prop="item.columnProp"
  268. :header-align="item.headerAlign"
  269. :show-overflow-tooltip="item.showOverflowTooltip"
  270. :align="item.align"
  271. :fixed="item.fixed==''?false:item.fixed"
  272. :min-width="item.columnWidth"
  273. :label="item.columnLabel">
  274. <template slot-scope="scope">
  275. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  276. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  277. </template>
  278. </el-table-column>
  279. </el-table>
  280. </div>
  281. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  282. <el-button type="primary" @click="methodModelFlag = false">关闭</el-button>
  283. </el-footer>
  284. </el-dialog>
  285. <!-- 设备-> 快速新增 -->
  286. <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="objectModelFlag" width="900px">
  287. <div style="font-size: 12px">
  288. <el-form :inline="true" label-position="top" :model="objectData">
  289. <el-form-item :label="'设备编码'">
  290. <el-input v-model="objectData.objectID" clearable style="width: 120px"></el-input>
  291. </el-form-item>
  292. <el-form-item :label="'设备名称'">
  293. <el-input v-model="objectData.objectDesc" clearable style="width: 120px"></el-input>
  294. </el-form-item>
  295. <el-form-item :label="' '">
  296. <el-button type="primary" @click="getObjectList">查询</el-button>
  297. </el-form-item>
  298. </el-form>
  299. </div>
  300. <el-container style="margin-top: 0px;">
  301. <el-main style="width: 350px; padding: 1px">
  302. <span style="font-size: 12px" >可选设备:</span>
  303. <el-table
  304. height="400px"
  305. :data="objectList1"
  306. border
  307. ref="objectTable1"
  308. @row-click="objectClickRow1"
  309. @selection-change="selectionObject1"
  310. highlight-current-row
  311. style="width: 100%">
  312. <el-table-column
  313. type="selection"
  314. header-align="center"
  315. align="center"
  316. width="50">
  317. </el-table-column>
  318. <el-table-column
  319. prop="objectID"
  320. header-align="center"
  321. align="center"
  322. min-width="80"
  323. label="设备编码">
  324. </el-table-column>
  325. <el-table-column
  326. prop="objectDesc"
  327. header-align="center"
  328. align="center"
  329. min-width="120"
  330. label="设备名称">
  331. </el-table-column>
  332. </el-table>
  333. </el-main>
  334. <el-main style="width: 111px;padding: -1px">
  335. <div style="margin-top: 182px;margin-left: 18px">
  336. <el-button type="primary" @click="addObject">添加>></el-button>
  337. </div>
  338. <div style="margin-top: 15px;margin-left: 18px">
  339. <el-button type="primary" @click="deleteObject">删除<<</el-button>
  340. </div>
  341. </el-main>
  342. <el-main style="width: 350px;padding: 1px">
  343. <span style="font-size: 12px" >已有设备:</span>
  344. <el-table
  345. height="400px"
  346. :data="objectList2"
  347. border
  348. ref="objectTable2"
  349. @row-click="objectClickRow2"
  350. @selection-change="selectionObject2"
  351. highlight-current-row
  352. style="width: 100%">
  353. <el-table-column
  354. type="selection"
  355. header-align="center"
  356. align="center"
  357. width="50">
  358. </el-table-column>
  359. <el-table-column
  360. prop="objectID"
  361. header-align="center"
  362. align="center"
  363. min-width="80"
  364. label="设备编码">
  365. </el-table-column>
  366. <el-table-column
  367. prop="objectDesc"
  368. header-align="center"
  369. align="center"
  370. min-width="120"
  371. label="设备名称">
  372. </el-table-column>
  373. <el-table-column
  374. header-align="center"
  375. align="center"
  376. min-width="50"
  377. label="默认">
  378. <template slot-scope="{row}">
  379. <el-checkbox v-model="row.defaultFlag" true-label="Y" @change="(val)=>defaultChange(row)" false-label="N"></el-checkbox>
  380. </template>
  381. </el-table-column>
  382. </el-table>
  383. </el-main>
  384. </el-container>
  385. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  386. <el-button type="primary" @click="updateItemObject">保存</el-button>
  387. <el-button type="primary" @click="objectModelFlag = false">关闭</el-button>
  388. </el-footer>
  389. </el-dialog>
  390. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  391. <!-- 导入 -->
  392. <qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
  393. </div>
  394. </template>
  395. <script>
  396. import {
  397. qcItemSearch, // 查询项目
  398. qcItemSave, // 新增项目
  399. qcItemUpdate, // 修改项目
  400. qcItemDelete, // 删除项目
  401. inspectionTypeSearch, // 查询检验类型
  402. queryMethodList, // 查询检验方法
  403. getSiteAndBuByUserName,
  404. getEquipmentNoList, // 获取采集条件路径
  405. getDataContentList, // 获取采集数据内容
  406. getObjectList, // 获取设备列表
  407. getObjectListBy,
  408. addItemObject, // 新增项目设备
  409. deleteItemObject, // 删除项目设备
  410. updateItemObject, // 修改项目设备
  411. } from "@/api/qc/qc.js"
  412. import { buildQcBu } from './qcBuUtils'
  413. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  414. import Chooselist from '@/views/modules/common/Chooselist_eam'
  415. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  416. import qcUpload from "./qc_upload"
  417. export default {
  418. components: {
  419. Chooselist,
  420. qcUpload
  421. },
  422. watch: {
  423. searchData: {
  424. deep: true,
  425. handler: function (newV, oldV) {
  426. this.searchData.itemNo = this.searchData.itemNo.toUpperCase()
  427. }
  428. },
  429. modalData: {
  430. deep: true,
  431. handler: function (newV, oldV) {
  432. this.modalData.itemNo = this.modalData.itemNo.toUpperCase()
  433. }
  434. },
  435. },
  436. data () {
  437. return {
  438. columnsProp:['createdBy', 'updateBy'],
  439. // 是否收藏
  440. favorite: false,
  441. // 导出 start
  442. exportData: [],
  443. exportName: "检验项目" + this.dayjs().format('YYYYMMDDHHmmss'),
  444. exportHeader: ["检验项目"],
  445. exportFooter: [],
  446. exportList: [],
  447. // 导出 end
  448. searchData: {
  449. site: this.$store.state.user.site,
  450. userName: this.$store.state.user.name,
  451. itemNo: '',
  452. itemDesc: '',
  453. itemType: 'D',
  454. inspectionTypeNo: '',
  455. buDesc: '',
  456. page: 1,
  457. limit: 10,
  458. },
  459. pageIndex: 1,
  460. pageSize: 20,
  461. totalPage: 0,
  462. height: 200,
  463. dataList: [],
  464. modalFlag: false,
  465. modalDisableFlag: false,
  466. modalData: {
  467. site: '',
  468. bu: '',
  469. flag: '',
  470. itemNo: '',
  471. itemDesc: '',
  472. valueTypeDb: '',
  473. defaultValue: '',
  474. createdBy: this.$store.state.user.name,
  475. maxValue: '',
  476. minValue: '',
  477. itemRemark: '',
  478. itemType: 'D',
  479. methodNo: '',
  480. methodName: '',
  481. updateBy: '',
  482. inspectionTypeNo: '',
  483. itemSamplingQuantity: '',
  484. samplingProgrammeNo: '',
  485. samplingProgrammeDesc: '',
  486. samplingLevelNo: '',
  487. samplingLevelDesc: '',
  488. defaultSamplingProportion: '',
  489. collectionFlag: '',
  490. collectionSource: '',
  491. collectionSourceList: [],
  492. collectionMethod: '',
  493. collectionMethodList: [],
  494. collectionCondition: '',
  495. collectionConditionList: [],
  496. collectionDataContent: ''
  497. },
  498. // 检验项目展示标头
  499. columnList: [
  500. // {
  501. // userId: this.$store.state.user.name,
  502. // functionId: 301002,
  503. // serialNumber: '301002TableBuDesc',
  504. // tableId: "301002Table",
  505. // tableName: "检验项目维护表",
  506. // columnProp: 'buDesc',
  507. // headerAlign: 'center',
  508. // align: "center",
  509. // columnLabel: 'BU',
  510. // columnHidden: false,
  511. // columnImage: false,
  512. // columnSortable: false,
  513. // sortLv: 0,
  514. // status: true,
  515. // fixed: '',
  516. // columnWidth: 100,
  517. // },
  518. {
  519. userId: this.$store.state.user.name,
  520. functionId: 301002,
  521. serialNumber: '301002TableItemNo',
  522. tableId: "301002Table",
  523. tableName: "检验项目维护表",
  524. columnProp: 'itemNo',
  525. headerAlign: 'center',
  526. align: "center",
  527. columnLabel: '检验项目编码',
  528. columnHidden: false,
  529. columnImage: false,
  530. columnSortable: false,
  531. sortLv: 0,
  532. status: true,
  533. fixed: '',
  534. columnWidth: 120,
  535. },
  536. {
  537. userId: this.$store.state.user.name,
  538. functionId: 301002,
  539. serialNumber: '301002TableItemDesc',
  540. tableId: "301002Table",
  541. tableName: "检验项目维护表",
  542. columnProp: 'itemDesc',
  543. headerAlign: 'center',
  544. align: "left",
  545. columnLabel: '检验项目名称',
  546. columnHidden: false,
  547. columnImage: false,
  548. columnSortable: false,
  549. sortLv: 0,
  550. status: true,
  551. fixed: '',
  552. columnWidth: 200,
  553. },
  554. {
  555. userId: this.$store.state.user.name,
  556. functionId: 301002,
  557. serialNumber: '301002TableMethodName',
  558. tableId: "301002Table",
  559. tableName: "检验项目维护表",
  560. columnProp: 'methodName',
  561. headerAlign: 'center',
  562. align: "left",
  563. columnLabel: '检验方法',
  564. columnHidden: false,
  565. columnImage: false,
  566. columnSortable: false,
  567. sortLv: 0,
  568. status: true,
  569. fixed: '',
  570. columnWidth: 200,
  571. },
  572. {
  573. userId: this.$store.state.user.name,
  574. functionId: 301002,
  575. serialNumber: '301002TableMethodRemark',
  576. tableId: "301002Table",
  577. tableName: "检验项目维护表",
  578. columnProp: 'methodRemark',
  579. headerAlign: 'center',
  580. align: "left",
  581. columnLabel: '检验方法说明',
  582. columnHidden: false,
  583. columnImage: false,
  584. columnSortable: false,
  585. sortLv: 0,
  586. status: true,
  587. fixed: '',
  588. columnWidth: 200,
  589. },
  590. {
  591. userId: this.$store.state.user.name,
  592. functionId: 301002,
  593. serialNumber: '301002TableValueType',
  594. tableId: "301002Table",
  595. tableName: "检验项目维护表",
  596. columnProp: 'valueType',
  597. headerAlign: 'center',
  598. align: "center",
  599. columnLabel: '检验值类型',
  600. columnHidden: false,
  601. columnImage: false,
  602. columnSortable: false,
  603. sortLv: 0,
  604. status: true,
  605. fixed: '',
  606. columnWidth: 100,
  607. },
  608. {
  609. userId: this.$store.state.user.name,
  610. functionId: 301002,
  611. serialNumber: '301002TableInspectionTypeName',
  612. tableId: "301002Table",
  613. tableName: "检验项目维护表",
  614. columnProp: 'inspectionTypeName',
  615. headerAlign: 'center',
  616. align: "center",
  617. columnLabel: '检验类型',
  618. columnHidden: false,
  619. columnImage: false,
  620. columnSortable: false,
  621. sortLv: 0,
  622. status: true,
  623. fixed: '',
  624. columnWidth: 100,
  625. },
  626. {
  627. userId: this.$store.state.user.name,
  628. functionId: 301002,
  629. serialNumber: '301002TableDefaultValue',
  630. tableId: "301002Table",
  631. tableName: "检验项目维护表",
  632. columnProp: 'defaultValue',
  633. headerAlign: 'center',
  634. align: "right",
  635. columnLabel: '标准值',
  636. columnHidden: false,
  637. columnImage: false,
  638. columnSortable: false,
  639. sortLv: 0,
  640. status: true,
  641. fixed: '',
  642. columnWidth: 100,
  643. },
  644. {
  645. userId: this.$store.state.user.name,
  646. functionId: 301002,
  647. serialNumber: '301002TableMaxValue',
  648. tableId: "301002Table",
  649. tableName: "检验项目维护表",
  650. columnProp: 'maxValue',
  651. headerAlign: 'center',
  652. align: "right",
  653. columnLabel: '最大值',
  654. columnHidden: false,
  655. columnImage: false,
  656. columnSortable: false,
  657. sortLv: 0,
  658. status: true,
  659. fixed: '',
  660. columnWidth: 100,
  661. },
  662. {
  663. userId: this.$store.state.user.name,
  664. functionId: 301002,
  665. serialNumber: '301002TableMinValue',
  666. tableId: "301002Table",
  667. tableName: "检验项目维护表",
  668. columnProp: 'minValue',
  669. headerAlign: 'center',
  670. align: "right",
  671. columnLabel: '最小值',
  672. columnHidden: false,
  673. columnImage: false,
  674. columnSortable: false,
  675. sortLv: 0,
  676. status: true,
  677. fixed: '',
  678. columnWidth: 100,
  679. },
  680. /*{
  681. userId: this.$store.state.user.name,
  682. functionId: 301002,
  683. serialNumber: '301002TableSamplingProgrammeDesc',
  684. tableId: "301002Table",
  685. tableName: "检验项目维护表",
  686. columnProp: 'samplingProgrammeDesc',
  687. headerAlign: 'center',
  688. align: "left",
  689. columnLabel: '抽样方案',
  690. columnHidden: false,
  691. columnImage: false,
  692. columnSortable: false,
  693. sortLv: 0,
  694. status: true,
  695. fixed: '',
  696. columnWidth: 120,
  697. },
  698. {
  699. userId: this.$store.state.user.name,
  700. functionId: 301002,
  701. serialNumber: '301002TableSamplingLevelDesco',
  702. tableId: "301002Table",
  703. tableName: "检验项目维护表",
  704. columnProp: 'samplingLevelDesc',
  705. headerAlign: 'center',
  706. align: "left",
  707. columnLabel: '检验水平',
  708. columnHidden: false,
  709. columnImage: false,
  710. columnSortable: false,
  711. sortLv: 0,
  712. status: true,
  713. fixed: '',
  714. columnWidth: 120,
  715. },*/
  716. // {
  717. // userId: this.$store.state.user.name,
  718. // functionId: 301002,
  719. // serialNumber: '301002TableItemSamplingQuantity',
  720. // tableId: "301002Table",
  721. // tableName: "检验项目维护表",
  722. // columnProp: 'itemSamplingQuantity',
  723. // headerAlign: 'center',
  724. // align: "right",
  725. // columnLabel: '抽样数量',
  726. // columnHidden: false,
  727. // columnImage: false,
  728. // columnSortable: false,
  729. // sortLv: 0,
  730. // status: true,
  731. // fixed: '',
  732. // columnWidth: 100,
  733. // },
  734. // {
  735. // userId: this.$store.state.user.name,
  736. // functionId: 301002,
  737. // serialNumber: '301002TableDefaultSamplingProportion',
  738. // tableId: "301002Table",
  739. // tableName: "检验项目维护表",
  740. // columnProp: 'defaultSamplingProportion',
  741. // headerAlign: 'center',
  742. // align: "right",
  743. // columnLabel: '抽样比例',
  744. // columnHidden: false,
  745. // columnImage: false,
  746. // columnSortable: false,
  747. // sortLv: 0,
  748. // status: true,
  749. // fixed: '',
  750. // columnWidth: 100,
  751. // },
  752. {
  753. userId: this.$store.state.user.name,
  754. functionId: 301002,
  755. serialNumber: '301002TableCreatedDate',
  756. tableId: "301002Table",
  757. tableName: "检验项目维护表",
  758. columnProp: 'createdDate',
  759. headerAlign: 'center',
  760. align: "center",
  761. columnLabel: '创建时间',
  762. columnHidden: false,
  763. columnImage: false,
  764. columnSortable: false,
  765. sortLv: 0,
  766. status: true,
  767. fixed: '',
  768. columnWidth: 170,
  769. },
  770. {
  771. userId: this.$store.state.user.name,
  772. functionId: 301002,
  773. serialNumber: '301002TableCreatedBy',
  774. tableId: "301002Table",
  775. tableName: "检验项目维护表",
  776. columnProp: 'createdBy',
  777. headerAlign: 'center',
  778. align: "center",
  779. columnLabel: '创建人',
  780. columnHidden: false,
  781. columnImage: false,
  782. columnSortable: false,
  783. sortLv: 0,
  784. status: true,
  785. fixed: '',
  786. columnWidth: 100,
  787. },
  788. {
  789. userId: this.$store.state.user.name,
  790. functionId: 301002,
  791. serialNumber: '301002TableUpdateDate',
  792. tableId: "301002Table",
  793. tableName: "检验项目维护表",
  794. columnProp: 'updateDate',
  795. headerAlign: 'center',
  796. align: "center",
  797. columnLabel: '更新时间',
  798. columnHidden: false,
  799. columnImage: false,
  800. columnSortable: false,
  801. sortLv: 0,
  802. status: true,
  803. fixed: '',
  804. columnWidth: 170,
  805. },
  806. {
  807. userId: this.$store.state.user.name,
  808. functionId: 301002,
  809. serialNumber: '301002TableUpdateBy',
  810. tableId: "301002Table",
  811. tableName: "检验项目维护表",
  812. columnProp: 'updateBy',
  813. headerAlign: 'center',
  814. align: "center",
  815. columnLabel: '更新人',
  816. columnHidden: false,
  817. columnImage: false,
  818. columnSortable: false,
  819. sortLv: 0,
  820. status: true,
  821. fixed: '',
  822. columnWidth: 100,
  823. },
  824. ],
  825. rules: {
  826. itemDescType:[
  827. {
  828. required: true,
  829. message: ' ',
  830. trigger: ['blur','change']
  831. }
  832. ],
  833. valueTypeDbType:[
  834. {
  835. required: true,
  836. message: ' ',
  837. trigger: ['blur','change']
  838. }
  839. ],
  840. methodNoType:[
  841. {
  842. required: true,
  843. message: ' ',
  844. trigger: ['blur','change']
  845. }
  846. ],
  847. methodNameType:[
  848. {
  849. required: true,
  850. message: ' ',
  851. trigger: ['blur','change']
  852. }
  853. ],
  854. inspectionTypeNoType:[
  855. {
  856. required: true,
  857. message: ' ',
  858. trigger: ['blur','change']
  859. }
  860. ],
  861. bu:[
  862. {
  863. required: true,
  864. message: ' ',
  865. trigger: ['blur','change']
  866. }
  867. ]
  868. },
  869. options: [],
  870. methodData: {
  871. site: '',
  872. bu: '',
  873. methodNo: '',
  874. methodName: '',
  875. inspectionTypeNo: '',
  876. inspectionTypeName: ''
  877. },
  878. methodList: [],
  879. methodModelFlag: false,
  880. methodDetailList: [
  881. {
  882. columnProp: 'methodNo',
  883. headerAlign: "center",
  884. align: "center",
  885. columnLabel: '方法编码',
  886. columnHidden: false,
  887. columnImage: false,
  888. columnSortable: false,
  889. sortLv: 0,
  890. status: true,
  891. fixed: '',
  892. },
  893. {
  894. columnProp: 'methodName',
  895. headerAlign: "center",
  896. align: "center",
  897. columnLabel: '方法名称',
  898. columnHidden: false,
  899. columnImage: false,
  900. columnSortable: false,
  901. sortLv: 0,
  902. status: true,
  903. fixed: '',
  904. },
  905. {
  906. columnProp: 'inspectionTypeName',
  907. headerAlign: "center",
  908. align: "center",
  909. columnLabel: '检验类型',
  910. columnHidden: false,
  911. columnImage: false,
  912. columnSortable: false,
  913. sortLv: 0,
  914. status: true,
  915. fixed: '',
  916. },
  917. ],
  918. userBuList: [],
  919. equipmentNoList: [],
  920. authSearch: false,
  921. authSave: false,
  922. authUpdate: false,
  923. authDelete: false,
  924. lineInspectionRoleFlag: false,
  925. pqcInspectionTypeNo: '108',
  926. menuId: this.$route.meta.menuId,
  927. dataContentList: [],
  928. objectSelections1: [],
  929. objectSelections2: [],
  930. objectList1: [],
  931. objectList2: [],
  932. objectData: {
  933. site: '',
  934. buNo: '',
  935. itemNo: '',
  936. objectID: '',
  937. objectDesc: '',
  938. },
  939. objectModelFlag: false
  940. }
  941. },
  942. mounted () {
  943. this.$nextTick(() => {
  944. this.height = window.innerHeight - 180
  945. })
  946. },
  947. created () {
  948. // 按钮控制
  949. this.getButtonAuthData()
  950. // 当前用户是否包含换线点检角色
  951. this.lineInspectionRoleFlag = this.resolveLineInspectionRoleFlag()
  952. // 获取用户的 site 和 bu
  953. this.getSiteAndBuByUserName()
  954. // 校验用户是否收藏
  955. this.favoriteIsOk()
  956. // 获取检验类型
  957. this.inspectionTypeSearch()
  958. // 动态列
  959. this.getTableUserColumn(this.$route.meta.menuId+'table',1)
  960. if (this.authSearch) {
  961. // 获取数据列表
  962. this.getDataList()
  963. }
  964. },
  965. methods: {
  966. // 默认设备
  967. defaultChange (row) {
  968. this.objectList2 = this.objectList2.map(val => {
  969. if (val.objectID === row.objectID) {
  970. return val
  971. }
  972. val.defaultFlag = 'N'
  973. return val
  974. })
  975. },
  976. // 绑定项目的设备
  977. itemObjectModal (row) {
  978. this.objectSelections1 = null
  979. this.objectSelections2 = null
  980. getObjectList(row).then(({data}) => {
  981. this.objectList1 = data.row1
  982. this.objectList2 = data.row2
  983. })
  984. this.objectData = {
  985. site: row.site,
  986. buNo: row.buNo,
  987. itemNo: row.itemNo,
  988. objectID: '',
  989. objectDesc: '',
  990. }
  991. this.objectModelFlag = true
  992. },
  993. // 选择设备
  994. getObjectList () {
  995. // 查询所有设备
  996. getObjectListBy(this.objectData).then(({data}) => {
  997. if (data && data.code === 0) {
  998. this.objectList1 = data.rows
  999. } else {
  1000. this.objectList1 = []
  1001. }
  1002. })
  1003. },
  1004. // 可选设备
  1005. objectClickRow1 (row) {
  1006. this.$refs.objectTable1.toggleRowSelection(row)
  1007. },
  1008. // 已有设备
  1009. objectClickRow2 (row) {
  1010. this.$refs.objectTable2.toggleRowSelection(row)
  1011. },
  1012. selectionObject1 (val) {
  1013. this.objectSelections1 = val
  1014. },
  1015. selectionObject2 (val) {
  1016. this.objectSelections2 = val
  1017. },
  1018. // 新增项目设备
  1019. addObject () {
  1020. if (this.objectSelections1 == null || this.objectSelections1.length === 0) {
  1021. this.$message.warning('请选择可选设备!')
  1022. return
  1023. }
  1024. let inData = {
  1025. site: this.objectData.site,
  1026. buNo: this.objectData.buNo,
  1027. itemNo: this.objectData.itemNo,
  1028. objectList: this.objectSelections1
  1029. }
  1030. addItemObject(inData).then(({data}) => {
  1031. if (data && data.code === 0) {
  1032. getObjectList(this.objectData).then(({data}) => {
  1033. this.objectList1 = data.row1
  1034. this.objectList2 = data.row2
  1035. })
  1036. this.objectSelections1 = []
  1037. } else {
  1038. this.$alert(data.msg, '错误', {
  1039. confirmButtonText: '确定'
  1040. })
  1041. }
  1042. })
  1043. },
  1044. // 删除项目设备
  1045. deleteObject () {
  1046. if(this.objectSelections2 == null || this.objectSelections2.length === 0){
  1047. this.$message.warning('请选择已有代理商!')
  1048. return
  1049. }
  1050. let inData = {
  1051. site: this.objectData.site,
  1052. buNo: this.objectData.buNo,
  1053. itemNo: this.objectData.itemNo,
  1054. objectList: this.objectSelections2
  1055. }
  1056. deleteItemObject(inData).then(({data}) => {
  1057. if (data && data.code === 0) {
  1058. getObjectList(this.objectData).then(({data}) => {
  1059. this.objectList1 = data.row1
  1060. this.objectList2 = data.row2
  1061. })
  1062. this.objectSelections2 = []
  1063. } else {
  1064. this.$alert(data.msg, '错误', {
  1065. confirmButtonText: '确定'
  1066. })
  1067. }
  1068. })
  1069. },
  1070. // 修改项目设备
  1071. updateItemObject () {
  1072. let inData = {
  1073. site: this.objectData.site,
  1074. buNo: this.objectData.buNo,
  1075. itemNo: this.objectData.itemNo,
  1076. objectList: this.objectList2
  1077. }
  1078. updateItemObject(inData).then(({data}) => {
  1079. if (data && data.code === 0) {
  1080. this.getDataList()
  1081. this.$message({
  1082. message: '操作成功',
  1083. type: 'success',
  1084. duration: 1500,
  1085. onClose: () => {}
  1086. })
  1087. this.objectModelFlag = false
  1088. } else {
  1089. this.$alert(data.msg, '错误', {
  1090. confirmButtonText: '确定'
  1091. })
  1092. }
  1093. })
  1094. },
  1095. // 获取用户的bu
  1096. getSiteAndBuByUserName () {
  1097. let tempData = {
  1098. username: this.$store.state.user.name,
  1099. site: this.$store.state.user.site,
  1100. }
  1101. getSiteAndBuByUserName(tempData).then(({data}) => {
  1102. if (data.code === 0) {
  1103. this.userBuList = data.rows
  1104. }
  1105. })
  1106. },
  1107. // 是否包含换线点检角色
  1108. resolveLineInspectionRoleFlag () {
  1109. return this.$store.state.user.lineInspectionRoleFlag === true || localStorage.getItem('lineInspectionRoleFlag') === 'Y'
  1110. },
  1111. // 获取PQC对应的检验类型编码
  1112. getPqcInspectionTypeNo () {
  1113. const pqcData = this.options.find(item => item.inspectionTypeName && item.inspectionTypeName==='PQC')
  1114. if (pqcData) {
  1115. this.pqcInspectionTypeNo = pqcData.inspectionTypeNo
  1116. }
  1117. return this.pqcInspectionTypeNo
  1118. },
  1119. // 换线点检角色仅允许PQC
  1120. applyPqcInspectionTypeLimit () {
  1121. if (!this.lineInspectionRoleFlag) {
  1122. return
  1123. }
  1124. const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
  1125. this.searchData.inspectionTypeNo = pqcInspectionTypeNo
  1126. this.modalData.inspectionTypeNo = pqcInspectionTypeNo
  1127. this.methodData.inspectionTypeNo = pqcInspectionTypeNo
  1128. },
  1129. // bu改变事件
  1130. buChangeFunction () {
  1131. //this.modalData.collectionConditionList = []
  1132. this.modalData.collectionDataContent = ''
  1133. //this.getEquipmentNoList()
  1134. this.getDataContentList()
  1135. },
  1136. // 获取采集条件路径
  1137. getEquipmentNoList () {
  1138. let tempData = {
  1139. bu: this.modalData.bu
  1140. }
  1141. getEquipmentNoList(tempData).then(({data}) => {
  1142. if (data.code === 0) {
  1143. this.equipmentNoList = data.rows
  1144. }
  1145. })
  1146. },
  1147. // 获取采集数据内容
  1148. getDataContentList () {
  1149. let tempData = {
  1150. bu: this.modalData.bu
  1151. }
  1152. getDataContentList(tempData).then(({data}) => {
  1153. if (data.code === 0) {
  1154. this.dataContentList = data.rows
  1155. }
  1156. })
  1157. },
  1158. // 获取基础数据列表S
  1159. getBaseList (val,type) {
  1160. this.tagNo = val
  1161. this.$nextTick(() => {
  1162. let strVal = ''
  1163. let conSql = ''
  1164. if (this.modalData.bu === null || this.modalData.bu === '') {
  1165. this.$message.warning("请选择BU!")
  1166. return
  1167. } else {
  1168. conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '*'"
  1169. }
  1170. if (val === 207) {
  1171. strVal = this.modalData.samplingProgrammeNo
  1172. }
  1173. if (val === 208) {
  1174. strVal = this.modalData.samplingLevelNo
  1175. }
  1176. if (val === 1036) {
  1177. strVal = this.modalData.methodNo
  1178. conSql = ''
  1179. }
  1180. this.$refs.baseList.init(val, strVal, conSql)
  1181. })
  1182. },
  1183. // 每页数
  1184. sizeChangeHandle (val) {
  1185. this.pageSize = val
  1186. this.pageIndex = 1
  1187. this.getDataList()
  1188. },
  1189. // 当前页
  1190. currentChangeHandle (val) {
  1191. this.pageIndex = val
  1192. this.getDataList()
  1193. },
  1194. // 查询检验类型
  1195. inspectionTypeSearch () {
  1196. let tempData = {
  1197. site: this.$store.state.user.site
  1198. }
  1199. inspectionTypeSearch(tempData).then(({data}) => {
  1200. if (data.code === 0) {
  1201. this.options = data.rows
  1202. if (this.lineInspectionRoleFlag) {
  1203. const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
  1204. this.options = this.options.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo)
  1205. this.searchData.inspectionTypeNo = pqcInspectionTypeNo
  1206. this.modalData.inspectionTypeNo = pqcInspectionTypeNo
  1207. this.methodData.inspectionTypeNo = pqcInspectionTypeNo
  1208. }
  1209. }
  1210. })
  1211. },
  1212. // 列表方法的回调
  1213. getBaseData (val) {
  1214. if (this.tagNo === 1036) {
  1215. this.modalData.methodNo = val.method_no
  1216. this.modalData.methodName = val.method_name
  1217. }
  1218. if (this.tagNo === 207) {
  1219. this.modalData.samplingProgrammeNo = val.sampling_programme_no
  1220. this.modalData.samplingProgrammeDesc = val.sampling_programme_desc
  1221. }
  1222. if (this.tagNo === 208) {
  1223. this.modalData.samplingLevelNo = val.sampling_level_no
  1224. this.modalData.samplingLevelDesc = val.sampling_level_desc
  1225. }
  1226. },
  1227. // 获取数据列表
  1228. getDataList () {
  1229. this.applyPqcInspectionTypeLimit()
  1230. this.searchData.limit = this.pageSize
  1231. this.searchData.page = this.pageIndex
  1232. qcItemSearch(this.searchData).then(({data}) => {
  1233. this.dataList = data.page.list
  1234. this.pageIndex = data.page.currPage
  1235. this.pageSize = data.page.pageSize
  1236. this.totalPage = data.page.totalCount
  1237. })
  1238. },
  1239. addModal () {
  1240. this.modalData = {
  1241. flag: '1',
  1242. site: '',
  1243. bu: this.userBuList[0].buNo,
  1244. createdBy: this.$store.state.user.name,
  1245. itemNo: '',
  1246. itemDesc: '',
  1247. valueTypeDb: 'T',
  1248. defaultValue: '',
  1249. maxValue: '',
  1250. minValue: '',
  1251. itemRemark: '',
  1252. itemType: 'D',
  1253. methodNo: '',
  1254. methodName: '',
  1255. updateBy: '',
  1256. inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : '',
  1257. itemSamplingQuantity: '',
  1258. samplingProgrammeNo: '',
  1259. samplingProgrammeDesc: '',
  1260. samplingLevelNo: '',
  1261. samplingLevelDesc: '',
  1262. defaultSamplingProportion: '',
  1263. collectionFlag: '',
  1264. collectionSource: '',
  1265. collectionSourceList: [],
  1266. collectionMethod: '',
  1267. collectionMethodList: [],
  1268. collectionCondition: '',
  1269. collectionConditionList: [],
  1270. collectionDataContent: ''
  1271. }
  1272. // 获取采集条件路径
  1273. this.getEquipmentNoList()
  1274. // 获取采集数据内容
  1275. this.getDataContentList()
  1276. this.modalDisableFlag = false
  1277. this.modalFlag = true
  1278. },
  1279. updateModal (row) {
  1280. this.modalData = {
  1281. flag: '2',
  1282. bu: buildQcBu(row.site),
  1283. site: row.site,
  1284. itemNo: row.itemNo,
  1285. itemDesc: row.itemDesc,
  1286. valueTypeDb: row.valueTypeDb,
  1287. defaultValue: row.defaultValue,
  1288. createdBy: this.$store.state.user.name,
  1289. maxValue: row.maxValue,
  1290. minValue: row.minValue,
  1291. itemRemark: row.itemRemark,
  1292. itemType: 'D',
  1293. methodNo: row.methodNo,
  1294. methodName: row.methodName,
  1295. updateBy: this.$store.state.user.name,
  1296. inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : row.inspectionTypeNo,
  1297. itemSamplingQuantity: row.itemSamplingQuantity,
  1298. samplingProgrammeNo: row.samplingProgrammeNo,
  1299. samplingProgrammeDesc: row.samplingProgrammeDesc,
  1300. samplingLevelNo: row.samplingLevelNo,
  1301. samplingLevelDesc: row.samplingLevelDesc,
  1302. defaultSamplingProportion: row.defaultSamplingProportion,
  1303. collectionFlag: row.collectionFlag,
  1304. collectionSource: row.collectionSource,
  1305. collectionSourceList: row.collectionSource == null || row.collectionSource === '' ? [] : row.collectionSource.split(','),
  1306. collectionMethod: row.collectionMethod,
  1307. collectionMethodList: row.collectionMethod == null || row.collectionMethod === '' ? [] : row.collectionMethod.split(','),
  1308. collectionCondition: row.collectionCondition,
  1309. collectionConditionList: row.collectionCondition == null || row.collectionCondition === '' ? [] : row.collectionCondition.split(','),
  1310. collectionDataContent: row.collectionDataContent
  1311. }
  1312. // 获取采集条件路径
  1313. this.getEquipmentNoList()
  1314. // 获取采集数据内容
  1315. this.getDataContentList()
  1316. this.modalDisableFlag = true
  1317. this.modalFlag = true
  1318. },
  1319. // 删除
  1320. deleteModal (row) {
  1321. this.$confirm(`是否删除这个检验项目?`, '提示', {
  1322. confirmButtonText: '确定',
  1323. cancelButtonText: '取消',
  1324. type: 'warning'
  1325. }).then(() => {
  1326. qcItemDelete(row).then(({data}) => {
  1327. if (data && data.code === 0) {
  1328. this.getDataList()
  1329. this.$message({
  1330. message: '操作成功',
  1331. type: 'success',
  1332. duration: 1500,
  1333. onClose: () => {}
  1334. })
  1335. } else {
  1336. this.$alert(data.msg, '错误', {
  1337. confirmButtonText: '确定'
  1338. })
  1339. }
  1340. })
  1341. }).catch(() => {
  1342. })
  1343. },
  1344. saveData () {
  1345. this.applyPqcInspectionTypeLimit()
  1346. if (this.modalData.bu === '' || this.modalData.bu == null) {
  1347. this.$message.warning('请选择BU!')
  1348. return
  1349. }
  1350. if (this.modalData.itemDesc === '' || this.modalData.itemDesc == null) {
  1351. this.$message.warning('请输入检验项目名称!')
  1352. return
  1353. }
  1354. if (this.modalData.valueTypeDb === '' || this.modalData.valueTypeDb == null) {
  1355. this.$message.warning('请选择检验值类型!')
  1356. return
  1357. }
  1358. if (this.modalData.inspectionTypeNo === '' || this.modalData.inspectionTypeNo == null) {
  1359. this.$message.warning('请选择检验类型!')
  1360. return
  1361. }
  1362. if (this.modalData.methodNo === '' || this.modalData.methodNo == null) {
  1363. this.$message.warning('请选择检验方法!')
  1364. return
  1365. }
  1366. if ((this.modalData.samplingProgrammeNo !== '' && this.modalData.samplingProgrammeNo != null) && (this.modalData.samplingLevelNo === '' || this.modalData.samplingLevelNo == null)) {
  1367. this.$message.warning('请选择检验水平!')
  1368. return
  1369. }
  1370. if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionSourceList == null || this.modalData.collectionSourceList.length === 0)) {
  1371. this.$message.warning('请选择采集数据来源!')
  1372. return
  1373. }
  1374. if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionMethodList == null || this.modalData.collectionMethodList.length === 0)) {
  1375. this.$message.warning('请选择采集数据方式!')
  1376. return
  1377. }
  1378. if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionMethodList.some(value => value === 'file') && this.modalData.collectionMethodList.some(value => value === 'plc'))) {
  1379. this.$message.warning('文件数据采集和PLC数据采集只能选一个!')
  1380. return
  1381. }
  1382. this.modalData.collectionSource = this.modalData.collectionSourceList.join(',')
  1383. this.modalData.collectionMethod = this.modalData.collectionMethodList.join(',')
  1384. //this.modalData.collectionCondition = this.modalData.collectionConditionList.join(',')
  1385. if (this.modalData.flag === '1') {
  1386. qcItemSave(this.modalData).then(({data}) => {
  1387. if (data && data.code === 0) {
  1388. this.getDataList()
  1389. this.modalFlag = false
  1390. this.$message({
  1391. message: '操作成功',
  1392. type: 'success',
  1393. duration: 1500,
  1394. onClose: () => {}
  1395. })
  1396. } else {
  1397. this.$alert(data.msg, '错误', {
  1398. confirmButtonText: '确定'
  1399. })
  1400. }
  1401. })
  1402. } else {
  1403. qcItemUpdate(this.modalData).then(({data}) => {
  1404. if (data && data.code === 0) {
  1405. this.getDataList()
  1406. this.modalFlag = false
  1407. this.$message({
  1408. message: '操作成功',
  1409. type: 'success',
  1410. duration: 1500,
  1411. onClose: () => {}
  1412. })
  1413. } else {
  1414. this.$alert(data.msg, '错误', {
  1415. confirmButtonText: '确定'
  1416. })
  1417. }
  1418. })
  1419. }
  1420. },
  1421. // 获取检验方法列表
  1422. queryMethodList () {
  1423. this.methodData.bu = this.modalData.bu
  1424. this.methodData.inspectionTypeNo = this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : this.modalData.inspectionTypeNo
  1425. queryMethodList(this.methodData).then(({data}) => {
  1426. if (data && data.code === 0) {
  1427. this.methodList = data.rows
  1428. this.methodModelFlag = true
  1429. } else {
  1430. this.$alert(data.msg, '错误', {
  1431. confirmButtonText: '确定'
  1432. })
  1433. }
  1434. })
  1435. },
  1436. // 选中检验方法
  1437. getRowData (row) {
  1438. this.modalData.methodNo = row.methodNo
  1439. this.modalData.methodName = row.methodName
  1440. this.methodModelFlag = false
  1441. },
  1442. // 校验用户是否收藏
  1443. favoriteIsOk () {
  1444. let userFavorite = {
  1445. userId: this.$store.state.user.id,
  1446. languageCode: this.$i18n.locale
  1447. }
  1448. userFavoriteList(userFavorite).then(({data}) => {
  1449. for (let i = 0; i < data.list.length; i++) {
  1450. if (this.$route.meta.menuId === data.list[i].menuId) {
  1451. this.favorite = true
  1452. }
  1453. }
  1454. })
  1455. },
  1456. // 收藏 OR 取消收藏
  1457. favoriteFunction () {
  1458. let userFavorite = {
  1459. userId: this.$store.state.user.id,
  1460. functionId: this.$route.meta.menuId,
  1461. }
  1462. if (this.favorite) {
  1463. removeUserFavorite(userFavorite).then(({data}) => {
  1464. this.$message.success(data.msg)
  1465. this.favorite = false
  1466. })
  1467. } else {
  1468. // 收藏
  1469. saveUserFavorite(userFavorite).then(({data}) => {
  1470. this.$message.success(data.msg)
  1471. this.favorite = true
  1472. })
  1473. }
  1474. },
  1475. //导出excel
  1476. async createExportData() {
  1477. this.applyPqcInspectionTypeLimit()
  1478. this.searchData.limit = -1
  1479. this.searchData.page = 1
  1480. await qcItemSearch(this.searchData).then(({data}) => {
  1481. this.exportList= data.page.list;
  1482. })
  1483. return this.exportList;
  1484. },
  1485. startDownload() {},
  1486. finishDownload() {},
  1487. fields () {
  1488. let json = "{"
  1489. this.columnList.forEach((item, index) => {
  1490. if (index == this.columnList.length - 1) {
  1491. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1492. } else {
  1493. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1494. }
  1495. })
  1496. json += "}"
  1497. let s = eval("(" + json + ")")
  1498. return s
  1499. },
  1500. // 导入
  1501. qcUpload () {
  1502. let currentData = {
  1503. flag: 'item',
  1504. createBy: this.$store.state.user.name,
  1505. site: this.$store.state.user.site,
  1506. }
  1507. //打开组件 去做新增业务
  1508. this.$nextTick(() => {
  1509. this.$refs.qcUpload.init(currentData)
  1510. })
  1511. },
  1512. // 动态列开始 获取 用户保存的 格式列
  1513. async getTableUserColumn (tableId, columnId) {
  1514. let queryTableUser = {
  1515. userId: this.$store.state.user.name,
  1516. functionId: this.$route.meta.menuId,
  1517. tableId: tableId,
  1518. status: true,
  1519. languageCode: this.$i18n.locale
  1520. }
  1521. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1522. if (data.rows.length > 0) {
  1523. //this.columnList1 = []
  1524. switch (columnId) {
  1525. case 1:
  1526. this.columnList = data.rows
  1527. break;
  1528. // case 2:
  1529. // this.columnDetailList = data.rows
  1530. // break;
  1531. // case 3:
  1532. // this.columnList2 = data.rows
  1533. // break;
  1534. // case 4:
  1535. // this.columnList3 = data.rows
  1536. // break;
  1537. }
  1538. } else {
  1539. this.getColumnList(tableId, columnId)
  1540. }
  1541. })
  1542. },
  1543. // 获取 tableDefault 列
  1544. async getColumnList (tableId, columnId) {
  1545. let queryTable = {
  1546. functionId: this.$route.meta.menuId,
  1547. tableId: tableId,
  1548. languageCode: this.$i18n.locale
  1549. }
  1550. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1551. if (!data.rows.length == 0) {
  1552. switch (columnId) {
  1553. case 1:
  1554. this.columnList = data.rows
  1555. break;
  1556. // case 2:
  1557. // this.columnDetailList = data.rows
  1558. // break;
  1559. // case 3:
  1560. // this.columnList2 = data.rows
  1561. // break;
  1562. // case 4:
  1563. // this.columnList3 = data.rows
  1564. // break;
  1565. }
  1566. } else {
  1567. // this.showDefault = true.
  1568. }
  1569. })
  1570. },
  1571. //获取按钮的权限数据
  1572. getButtonAuthData () {
  1573. let searchFlag = this.isAuth(this.menuId+":search")
  1574. let saveFlag = this.isAuth(this.menuId+":save")
  1575. let updateFlag = this.isAuth(this.menuId+":update")
  1576. let deleteFlag = this.isAuth(this.menuId+":delete")
  1577. //处理页面的权限数据
  1578. this.authSearch = searchFlag
  1579. this.authSave = saveFlag
  1580. this.authUpdate = updateFlag
  1581. this.authDelete = deleteFlag
  1582. },
  1583. }
  1584. }
  1585. </script>
  1586. <style scoped>
  1587. .el-table /deep/ .cell{
  1588. height: auto;
  1589. line-height: 1.5;
  1590. }
  1591. </style>