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.

969 lines
32 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 收藏 -->
  4. <div>
  5. <span @click="favoriteFunction()">
  6. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  7. </span>
  8. </div>
  9. <!-- 条件查询 -->
  10. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  11. <el-form-item :label="'BU'">
  12. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
  13. <el-option
  14. v-for = "i in userBuList"
  15. :key = "i.buNo"
  16. :label = "i.buDesc"
  17. :value = "i.buDesc">
  18. </el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item :label="'检验水平'">
  22. <el-input v-model="searchData.samplingLevelDesc" clearable style="width: 120px"></el-input>
  23. </el-form-item>
  24. <el-form-item :label="'样本量字码'">
  25. <el-input v-model="searchData.samplingQtyDesc" clearable style="width: 120px"></el-input>
  26. </el-form-item>
  27. <el-form-item :label="'是否可用'">
  28. <el-select v-model="searchData.samplingPlanActive" style="width: 130px">
  29. <el-option label="全部" value=""></el-option>
  30. <el-option label="是" value="Y"></el-option>
  31. <el-option label="否" value="N"></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item :label="' '">
  35. <!-- <el-button @click="doEmpty()">清空</el-button>-->
  36. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  37. <el-button v-if="!authSave" type="primary" @click="addModal()">新增</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. v-loading="dataListLoading"
  60. style="width: 100%;">
  61. <el-table-column
  62. v-for="(item,index) in columnList" :key="index"
  63. :sortable="item.columnSortable"
  64. :prop="item.columnProp"
  65. :header-align="item.headerAlign"
  66. :show-overflow-tooltip="item.showOverflowTooltip"
  67. :align="item.align"
  68. :fixed="item.fixed === ''?false:item.fixed"
  69. :min-width="item.columnWidth"
  70. :label="item.columnLabel">
  71. <template slot-scope="scope">
  72. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  73. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. fixed="right"
  78. header-align="center"
  79. align="center"
  80. width="160"
  81. label="操作">
  82. <template slot-scope="scope">
  83. <a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  84. <a v-if="!authDelete" type="text" size="small" @click="deleteModal(scope.row)">删除</a>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <!-- 分页-->
  89. <el-pagination
  90. @size-change="sizeChangeHandle"
  91. @current-change="currentChangeHandle"
  92. :current-page="pageIndex"
  93. :page-sizes="[20, 50, 100, 200, 500]"
  94. :page-size="pageSize"
  95. :total="totalPage"
  96. layout="total, sizes, prev, pager, next, jumper">
  97. </el-pagination>
  98. <!-- 新增和修改 -->
  99. <el-dialog title="样本量字码矩阵" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="500px">
  100. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  101. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  102. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 456px">
  103. <el-option
  104. v-for = "i in userBuList"
  105. :key = "i.buNo"
  106. :label = "i.sitename"
  107. :value = "i.buNo">
  108. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  109. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  110. {{ i.buDesc }}
  111. </span>
  112. </el-option>
  113. </el-select>
  114. </el-form-item>
  115. </el-form>
  116. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  117. <el-form-item label="矩阵名称:" prop="samplingPlanDesc" :rules="rules.samplingPlanDescType">
  118. <el-input v-model="modalData.samplingPlanDesc" style="width: 221px"></el-input>
  119. </el-form-item>
  120. <el-form-item label="是否在用:" prop="samplingPlanActive" :rules="rules.samplingPlanActiveType">
  121. <el-select filterable v-model="modalData.samplingPlanActive" style="width: 221px">
  122. <el-option label="是" value="Y"></el-option>
  123. <el-option label="否" value="N"></el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-form>
  127. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  128. <el-form-item prop="samplingQtyNo" :rules="rules.samplingQtyNoType">
  129. <span slot="label" style="" @click="getBaseList(210)"><a herf="#">样本量编码</a></span>
  130. <el-input v-model="modalData.samplingQtyNo" style="width: 221px"></el-input>
  131. </el-form-item>
  132. <el-form-item label="样本量字码:" prop="samplingQtyDesc" :rules="rules.samplingQtyDescType">
  133. <el-input v-model="modalData.samplingQtyDesc" disabled style="width: 221px"></el-input>
  134. </el-form-item>
  135. </el-form>
  136. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  137. <el-form-item prop="samplingQtyRankNo" :rules="rules.samplingQtyRankNoType">
  138. <span slot="label" style="" @click="getBaseList(209)"><a herf="#">抽样量级别编码</a></span>
  139. <el-input v-model="modalData.samplingQtyRankNo" style="width: 221px"></el-input>
  140. </el-form-item>
  141. <el-form-item label="抽样量级别名称:" prop="samplingQtyRankDesc" :rules="rules.samplingQtyRankDescType">
  142. <el-input v-model="modalData.samplingQtyRankDesc" disabled style="width: 221px"></el-input>
  143. </el-form-item>
  144. </el-form>
  145. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  146. <el-form-item prop="samplingLevelNo" :rules="rules.samplingLevelNoType">
  147. <span slot="label" style="" @click="getBaseList(208)"><a herf="#">抽样等级编码</a></span>
  148. <el-input v-model="modalData.samplingLevelNo" style="width: 221px"></el-input>
  149. </el-form-item>
  150. <el-form-item label="抽样等级名称:" prop="samplingLevelDesc" :rules="rules.samplingLevelDescType">
  151. <el-input v-model="modalData.samplingLevelDesc" disabled style="width: 221px"></el-input>
  152. </el-form-item>
  153. </el-form>
  154. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  155. <el-button type="primary" @click="saveData()">保存</el-button>
  156. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  157. </el-footer>
  158. </el-dialog>
  159. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  160. </div>
  161. </template>
  162. <script>
  163. import {
  164. samplingInspectionPlanSearch, // 查询矩阵
  165. samplingInspectionPlanSave, // 新增矩阵
  166. samplingInspectionPlanUpdate, // 修改矩阵
  167. samplingInspectionPlanDelete, // 删除矩阵
  168. getSiteAndBuByUserName
  169. } from "@/api/qc/qc.js"
  170. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  171. import Chooselist from '@/views/modules/common/Chooselist_eam'
  172. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  173. export default {
  174. components: {
  175. Chooselist
  176. },
  177. watch: {
  178. modalData: {
  179. deep: true,
  180. handler: function (newV, oldV) {
  181. this.modalData.samplingPlanNo = this.modalData.samplingPlanNo.toUpperCase()
  182. }
  183. }
  184. },
  185. data () {
  186. return {
  187. // 是否收藏
  188. favorite: false,
  189. // 导出 start
  190. exportData: [],
  191. exportName: "检验项目" + this.dayjs().format('YYYYMMDDHHmmss'),
  192. exportHeader: ["检验项目"],
  193. exportFooter: [],
  194. exportList: [],
  195. // 导出 end
  196. // 条件查询对象
  197. searchData: {
  198. site: '',
  199. userName: this.$store.state.user.name,
  200. samplingLevelDesc: '',
  201. samplingQtyDesc: '',
  202. samplingPlanActive: '',
  203. buDesc: '',
  204. page: 1,
  205. limit: 10,
  206. },
  207. // 分页对象
  208. pageIndex: 1,
  209. pageSize: 20,
  210. totalPage: 0,
  211. height: 200,
  212. dataList: [],
  213. dataListLoading: false,
  214. dataListSelections: [],
  215. // 其它对象
  216. modalFlag: false,
  217. modalDisableFlag: false,
  218. modalData: {
  219. flag: '',
  220. site: '',
  221. bu: '',
  222. samplingPlanNo: '',
  223. samplingPlanDesc: '',
  224. samplingQtyNo: '',
  225. samplingQty: '',
  226. samplingQtyDesc: '',
  227. samplingQtyRankDesc: '',
  228. samplingQtyRankNo: '',
  229. minQty: '',
  230. maxQty: '',
  231. samplingLevelNo: '',
  232. samplingLevelDesc: '',
  233. samplingPlanActive: '',
  234. createBy: this.$store.state.user.name,
  235. updateBy: this.$store.state.user.name
  236. },
  237. detailData: {
  238. id: '',
  239. site: '',
  240. buNo: '',
  241. samplingQtyRankNo: '',
  242. samplingQtyRankDesc: '',
  243. samplingLevelNo: '',
  244. samplingLevelDesc: '',
  245. samplingQtyNo: '',
  246. samplingQty: '',
  247. samplingPlanActive: ''
  248. },
  249. // 展示标头
  250. columnList: [
  251. {
  252. userId: this.$store.state.user.name,
  253. functionId: 301012,
  254. serialNumber: '301012TableBuDesc',
  255. tableId: "301012Table",
  256. tableName: "样本量字码矩阵表",
  257. columnProp: 'buDesc',
  258. headerAlign: 'center',
  259. align: "center",
  260. columnLabel: 'BU',
  261. columnHidden: false,
  262. columnImage: false,
  263. columnSortable: false,
  264. sortLv: 0,
  265. status: true,
  266. fixed: '',
  267. columnWidth: 100,
  268. },
  269. {
  270. userId: this.$store.state.user.name,
  271. functionId: 301012,
  272. serialNumber: '301012TableSamplingPlanNo',
  273. tableId: "301012Table",
  274. tableName: "样本量字码矩阵表",
  275. columnProp: 'samplingPlanNo',
  276. headerAlign: 'center',
  277. align: "center",
  278. columnLabel: '矩阵编码',
  279. columnHidden: false,
  280. columnImage: false,
  281. columnSortable: false,
  282. sortLv: 0,
  283. status: true,
  284. fixed: '',
  285. columnWidth: 100,
  286. },
  287. {
  288. userId: this.$store.state.user.name,
  289. functionId: 301012,
  290. serialNumber: '301012TableSamplingPlanDesc',
  291. tableId: "301012Table",
  292. tableName: "样本量字码矩阵表",
  293. columnProp: 'samplingPlanDesc',
  294. headerAlign: 'center',
  295. align: "center",
  296. columnLabel: '矩阵名称',
  297. columnHidden: false,
  298. columnImage: false,
  299. columnSortable: false,
  300. sortLv: 0,
  301. status: true,
  302. fixed: '',
  303. columnWidth: 100,
  304. },
  305. {
  306. userId: this.$store.state.user.name,
  307. functionId: 301012,
  308. serialNumber: '301012TableSamplingQtyDesc',
  309. tableId: "301012Table",
  310. tableName: "样本量字码矩阵表",
  311. columnProp: 'samplingQtyDesc',
  312. headerAlign: 'center',
  313. align: "center",
  314. columnLabel: '样本量字码',
  315. columnHidden: false,
  316. columnImage: false,
  317. columnSortable: false,
  318. sortLv: 0,
  319. status: true,
  320. fixed: '',
  321. columnWidth: 100,
  322. },
  323. {
  324. userId: this.$store.state.user.name,
  325. functionId: 301012,
  326. serialNumber: '301012TableSamplingQty',
  327. tableId: "301012Table",
  328. tableName: "样本量字码矩阵表",
  329. columnProp: 'samplingQty',
  330. headerAlign: 'center',
  331. align: "right",
  332. columnLabel: '样本量',
  333. columnHidden: false,
  334. columnImage: false,
  335. columnSortable: false,
  336. sortLv: 0,
  337. status: true,
  338. fixed: '',
  339. columnWidth: 100,
  340. },
  341. {
  342. userId: this.$store.state.user.name,
  343. functionId: 301012,
  344. serialNumber: '301012TableSamplingQtyRankDesc',
  345. tableId: "301012Table",
  346. tableName: "样本量字码矩阵表",
  347. columnProp: 'samplingQtyRankDesc',
  348. headerAlign: 'center',
  349. align: "right",
  350. columnLabel: '批量级次',
  351. columnHidden: false,
  352. columnImage: false,
  353. columnSortable: false,
  354. sortLv: 0,
  355. status: true,
  356. fixed: '',
  357. columnWidth: 200,
  358. },
  359. {
  360. userId: this.$store.state.user.name,
  361. functionId: 301012,
  362. serialNumber: '301012TableMinQty',
  363. tableId: "301012Table",
  364. tableName: "样本量字码矩阵表",
  365. columnProp: 'minQty',
  366. headerAlign: 'center',
  367. align: "right",
  368. columnLabel: '最小抽样数',
  369. columnHidden: false,
  370. columnImage: false,
  371. columnSortable: false,
  372. sortLv: 0,
  373. status: true,
  374. fixed: '',
  375. columnWidth: 110,
  376. },
  377. {
  378. userId: this.$store.state.user.name,
  379. functionId: 301012,
  380. serialNumber: '301012TableMaxQty',
  381. tableId: "301012Table",
  382. tableName: "样本量字码矩阵表",
  383. columnProp: 'maxQty',
  384. headerAlign: 'center',
  385. align: "right",
  386. columnLabel: '最大抽样数',
  387. columnHidden: false,
  388. columnImage: false,
  389. columnSortable: false,
  390. sortLv: 0,
  391. status: true,
  392. fixed: '',
  393. columnWidth: 110,
  394. },
  395. {
  396. userId: this.$store.state.user.name,
  397. functionId: 301012,
  398. serialNumber: '301012TableSamplingLevelDesc',
  399. tableId: "301012Table",
  400. tableName: "样本量字码矩阵表",
  401. columnProp: 'samplingLevelDesc',
  402. headerAlign: 'center',
  403. align: "left",
  404. columnLabel: '抽样等级',
  405. columnHidden: false,
  406. columnImage: false,
  407. columnSortable: false,
  408. sortLv: 0,
  409. status: true,
  410. fixed: '',
  411. columnWidth: 200,
  412. },
  413. {
  414. userId: this.$store.state.user.name,
  415. functionId: 301012,
  416. serialNumber: '301012TableSamplingPlanActive',
  417. tableId: "301012Table",
  418. tableName: "样本量字码矩阵表",
  419. columnProp: 'samplingPlanActive',
  420. headerAlign: 'center',
  421. align: "center",
  422. columnLabel: '是否可用',
  423. columnHidden: false,
  424. columnImage: false,
  425. columnSortable: false,
  426. sortLv: 0,
  427. status: true,
  428. fixed: '',
  429. columnWidth: 100,
  430. },
  431. {
  432. userId: this.$store.state.user.name,
  433. functionId: 301012,
  434. serialNumber: '301012TableCreateDate',
  435. tableId: "301012Table",
  436. tableName: "样本量字码矩阵表",
  437. columnProp: 'createDate',
  438. headerAlign: 'center',
  439. align: "center",
  440. columnLabel: '创建时间',
  441. columnHidden: false,
  442. columnImage: false,
  443. columnSortable: false,
  444. sortLv: 0,
  445. status: true,
  446. fixed: '',
  447. columnWidth: 170,
  448. },
  449. {
  450. userId: this.$store.state.user.name,
  451. functionId: 301012,
  452. serialNumber: '301012TableCreateBy',
  453. tableId: "301012Table",
  454. tableName: "样本量字码矩阵表",
  455. columnProp: 'createBy',
  456. headerAlign: 'center',
  457. align: "center",
  458. columnLabel: '创建人',
  459. columnHidden: false,
  460. columnImage: false,
  461. columnSortable: false,
  462. sortLv: 0,
  463. status: true,
  464. fixed: '',
  465. columnWidth: 100,
  466. },
  467. {
  468. userId: this.$store.state.user.name,
  469. functionId: 301012,
  470. serialNumber: '301012TableUpdateDate',
  471. tableId: "301012Table",
  472. tableName: "样本量字码矩阵表",
  473. columnProp: 'updateDate',
  474. headerAlign: 'center',
  475. align: "center",
  476. columnLabel: '更新时间',
  477. columnHidden: false,
  478. columnImage: false,
  479. columnSortable: false,
  480. sortLv: 0,
  481. status: true,
  482. fixed: '',
  483. columnWidth: 170,
  484. },
  485. {
  486. userId: this.$store.state.user.name,
  487. functionId: 301012,
  488. serialNumber: '301012TableUpdateBy',
  489. tableId: "301012Table",
  490. tableName: "样本量字码矩阵表",
  491. columnProp: 'updateBy',
  492. headerAlign: 'center',
  493. align: "center",
  494. columnLabel: '更新人',
  495. columnHidden: false,
  496. columnImage: false,
  497. columnSortable: false,
  498. sortLv: 0,
  499. status: true,
  500. fixed: '',
  501. columnWidth: 100,
  502. },
  503. ],
  504. rules: {
  505. samplingPlanDescType:[
  506. {
  507. required: true,
  508. message: ' ',
  509. trigger: ['blur','change']
  510. }
  511. ],
  512. samplingPlanActiveType:[
  513. {
  514. required: true,
  515. message: ' ',
  516. trigger: ['blur','change']
  517. }
  518. ],
  519. samplingQtyNoType:[
  520. {
  521. required: true,
  522. message: ' ',
  523. trigger: ['blur','change']
  524. }
  525. ],
  526. samplingQtyDescType:[
  527. {
  528. required: true,
  529. message: ' ',
  530. trigger: ['blur','change']
  531. }
  532. ],
  533. samplingQtyRankNoType:[
  534. {
  535. required: true,
  536. message: ' ',
  537. trigger: ['blur','change']
  538. }
  539. ],
  540. samplingQtyRankDescType:[
  541. {
  542. required: true,
  543. message: ' ',
  544. trigger: ['blur','change']
  545. }
  546. ],
  547. samplingLevelNoType:[
  548. {
  549. required: true,
  550. message: ' ',
  551. trigger: ['blur','change']
  552. }
  553. ],
  554. samplingLevelDescType:[
  555. {
  556. required: true,
  557. message: ' ',
  558. trigger: ['blur','change']
  559. }
  560. ],
  561. bu:[
  562. {
  563. required: true,
  564. message: ' ',
  565. trigger: ['blur','change']
  566. }
  567. ]
  568. },
  569. userBuList: [],
  570. authSearch: false,
  571. authSave: false,
  572. authUpdate: false,
  573. authDelete: false,
  574. menuId: this.$route.meta.menuId,
  575. }
  576. },
  577. mounted () {
  578. this.$nextTick(() => {
  579. this.height = window.innerHeight - 180
  580. })
  581. },
  582. created () {
  583. // 按钮控制
  584. this.getButtonAuthData()
  585. // 获取用户的 site 和 bu
  586. this.getSiteAndBuByUserName()
  587. // 校验用户是否收藏
  588. this.favoriteIsOk()
  589. // 动态列
  590. this.getTableUserColumn(this.$route.meta.menuId+'table',1)
  591. if (!this.authSearch) {
  592. // 获取数据列表
  593. this.getDataList()
  594. }
  595. },
  596. methods: {
  597. // 获取用户的bu
  598. getSiteAndBuByUserName () {
  599. let tempData = {
  600. username: this.$store.state.user.name,
  601. }
  602. getSiteAndBuByUserName(tempData).then(({data}) => {
  603. if (data.code === 0) {
  604. this.userBuList = data.rows
  605. }
  606. })
  607. },
  608. // 获取数据列表
  609. getDataList () {
  610. this.searchData.limit = this.pageSize
  611. this.searchData.page = this.pageIndex
  612. samplingInspectionPlanSearch(this.searchData).then(({data}) => {
  613. if (data.code === 0) {
  614. this.dataList = data.page.list
  615. this.pageIndex = data.page.currPage
  616. this.pageSize = data.page.pageSize
  617. this.totalPage = data.page.totalCount
  618. }
  619. this.dataListLoading = false
  620. })
  621. },
  622. // 每页数
  623. sizeChangeHandle (val) {
  624. this.pageSize = val
  625. this.pageIndex = 1
  626. this.getDataList()
  627. },
  628. // 当前页
  629. currentChangeHandle (val) {
  630. this.pageIndex = val
  631. this.getDataList()
  632. },
  633. // 多选
  634. selectionChangeHandle (val) {
  635. this.dataListSelections = val
  636. },
  637. // 获取方法数据列表
  638. getBaseList (val,type) {
  639. this.tagNo = val
  640. this.$nextTick(() => {
  641. let strVal = ''
  642. if (val === 210) {
  643. strVal = this.detailData.samplingQtyNo
  644. this.$refs.baseList.init(val, strVal)
  645. }
  646. if (val === 209) {
  647. strVal = this.detailData.samplingQtyRankNo
  648. this.$refs.baseList.init(val, strVal)
  649. }
  650. if (val === 208) {
  651. strVal = this.detailData.samplingLevelNo
  652. this.$refs.baseList.init(val, strVal)
  653. }
  654. })
  655. },
  656. // 列表方法的回调
  657. getBaseData (val) {
  658. if (this.tagNo === 210) {
  659. this.modalData.samplingQtyNo = val.sampling_qty_no
  660. this.modalData.samplingQtyDesc = val.sampling_qty_desc
  661. }
  662. if (this.tagNo === 209) {
  663. this.modalData.samplingQtyRankNo = val.sampling_qty_rank_no
  664. this.modalData.samplingQtyRankDesc = val.sampling_qty_rank_desc
  665. }
  666. if (this.tagNo === 208) {
  667. this.modalData.samplingLevelNo = val.sampling_level_no
  668. this.modalData.samplingLevelDesc = val.sampling_level_desc
  669. }
  670. },
  671. // 新增
  672. addModal () {
  673. this.modalData = {
  674. flag: '1',
  675. site: '',
  676. bu: this.userBuList[0].buNo,
  677. samplingPlanNo: '',
  678. samplingQtyNo: '',
  679. samplingQty: '',
  680. samplingQtyDesc: '',
  681. samplingQtyRankDesc: '',
  682. samplingQtyRankNo: '',
  683. minQty: '',
  684. maxQty: '',
  685. samplingLevelNo: '',
  686. samplingLevelDesc: '',
  687. samplingPlanActive: 'Y',
  688. createBy: this.$store.state.user.name,
  689. updateBy: this.$store.state.user.name
  690. }
  691. this.modalDisableFlag = false
  692. this.modalFlag = true
  693. },
  694. // 修改
  695. updateModal (row) {
  696. this.modalData = {
  697. flag: '2',
  698. bu: row.site + '_' + row.buNo,
  699. site: row.site,
  700. samplingPlanNo: row.samplingPlanNo,
  701. samplingPlanDesc: row.samplingPlanDesc,
  702. samplingQtyNo: row.samplingQtyNo,
  703. samplingQty: row.samplingQty,
  704. samplingQtyDesc: row.samplingQtyDesc,
  705. samplingQtyRankDesc: row.samplingQtyRankDesc,
  706. samplingQtyRankNo: row.samplingQtyRankNo,
  707. minQty: row.minQty,
  708. maxQty: row.maxQty,
  709. samplingLevelNo: row.samplingLevelNo,
  710. samplingLevelDesc: row.samplingLevelDesc,
  711. samplingPlanActive: row.samplingPlanActive,
  712. createBy: this.$store.state.user.name,
  713. updateBy: this.$store.state.user.name
  714. }
  715. this.modalDisableFlag = true
  716. this.modalFlag = true
  717. },
  718. // 删除
  719. deleteModal (row) {
  720. this.$confirm(`是否删除这个矩阵?`, '提示', {
  721. confirmButtonText: '确定',
  722. cancelButtonText: '取消',
  723. type: 'warning'
  724. }).then(() => {
  725. samplingInspectionPlanDelete(row).then(({data}) => {
  726. if (data && data.code === 0) {
  727. this.getDataList()
  728. this.$message({
  729. message: '操作成功',
  730. type: 'success',
  731. duration: 1500,
  732. onClose: () => {}
  733. })
  734. } else {
  735. this.$alert(data.msg, '错误', {
  736. confirmButtonText: '确定'
  737. })
  738. }
  739. })
  740. }).catch(() => {
  741. })
  742. },
  743. saveData () {
  744. if (this.modalData.bu === '' || this.modalData.bu == null) {
  745. this.$message.warning('请选择BU!')
  746. return
  747. }
  748. if (this.modalData.samplingPlanDesc === '' || this.modalData.samplingPlanDesc == null) {
  749. this.$message.warning('请输入矩阵名称!')
  750. return
  751. }
  752. if (this.modalData.samplingQtyNo === '' || this.modalData.samplingQtyNo == null) {
  753. this.$message.warning('请选择样本量编码!')
  754. return
  755. }
  756. if (this.modalData.samplingQtyRankNo === '' || this.modalData.samplingQtyRankNo == null) {
  757. this.$message.warning('请选择批量级次编码!')
  758. return
  759. }
  760. if (this.modalData.samplingLevelNo === '' || this.modalData.samplingLevelNo == null) {
  761. this.$message.warning('请选择检验水平编码!')
  762. return
  763. }
  764. if (this.modalData.samplingPlanActive === '' || this.modalData.samplingPlanActive == null) {
  765. this.$message.warning('请选择是否在用!')
  766. return
  767. }
  768. if (this.modalData.flag === '1') {
  769. samplingInspectionPlanSave(this.modalData).then(({data}) => {
  770. if (data && data.code === 0) {
  771. this.getDataList()
  772. this.modalFlag = false
  773. this.$message({
  774. message: '操作成功',
  775. type: 'success',
  776. duration: 1500,
  777. onClose: () => {}
  778. })
  779. } else {
  780. this.$alert(data.msg, '错误', {
  781. confirmButtonText: '确定'
  782. })
  783. }
  784. })
  785. } else {
  786. samplingInspectionPlanUpdate(this.modalData).then(({data}) => {
  787. if (data && data.code === 0) {
  788. this.getDataList()
  789. this.modalFlag = false
  790. this.$message({
  791. message: '操作成功',
  792. type: 'success',
  793. duration: 1500,
  794. onClose: () => {}
  795. })
  796. } else {
  797. this.$alert(data.msg, '错误', {
  798. confirmButtonText: '确定'
  799. })
  800. }
  801. })
  802. }
  803. },
  804. // 校验用户是否收藏
  805. favoriteIsOk () {
  806. let userFavorite = {
  807. userId: this.$store.state.user.id,
  808. languageCode: this.$i18n.locale
  809. }
  810. userFavoriteList(userFavorite).then(({data}) => {
  811. for (let i = 0; i < data.list.length; i++) {
  812. if (this.$route.meta.menuId === data.list[i].menuId) {
  813. this.favorite = true
  814. }
  815. }
  816. })
  817. },
  818. // 收藏 OR 取消收藏
  819. favoriteFunction () {
  820. let userFavorite = {
  821. userId: this.$store.state.user.id,
  822. functionId: this.$route.meta.menuId,
  823. }
  824. if (this.favorite) {
  825. removeUserFavorite(userFavorite).then(({data}) => {
  826. this.$message.success(data.msg)
  827. this.favorite = false
  828. })
  829. } else {
  830. // 收藏
  831. saveUserFavorite(userFavorite).then(({data}) => {
  832. this.$message.success(data.msg)
  833. this.favorite = true
  834. })
  835. }
  836. },
  837. //导出excel
  838. async createExportData () {
  839. this.searchData.limit = -1
  840. this.searchData.page = 1
  841. await samplingInspectionPlanSearch(this.searchData).then(({data}) => {
  842. this.exportList = data.page.list
  843. })
  844. return this.exportList
  845. },
  846. startDownload() {},
  847. finishDownload() {},
  848. fields () {
  849. let json = "{"
  850. this.columnList.forEach((item, index) => {
  851. if (index == this.columnList.length - 1) {
  852. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  853. } else {
  854. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  855. }
  856. })
  857. json += "}"
  858. let s = eval("(" + json + ")")
  859. return s
  860. },
  861. // 动态列开始 获取 用户保存的 格式列
  862. async getTableUserColumn (tableId, columnId) {
  863. let queryTableUser = {
  864. userId: this.$store.state.user.name,
  865. functionId: this.$route.meta.menuId,
  866. tableId: tableId,
  867. status: true,
  868. languageCode: this.$i18n.locale
  869. }
  870. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  871. if (data.rows.length > 0) {
  872. //this.columnList1 = []
  873. switch (columnId) {
  874. case 1:
  875. this.columnList = data.rows
  876. break;
  877. // case 2:
  878. // this.columnDetailList = data.rows
  879. // break;
  880. // case 3:
  881. // this.columnList2 = data.rows
  882. // break;
  883. // case 4:
  884. // this.columnList3 = data.rows
  885. // break;
  886. }
  887. } else {
  888. this.getColumnList(tableId, columnId)
  889. }
  890. })
  891. },
  892. // 获取 tableDefault 列
  893. async getColumnList(tableId, columnId) {
  894. let queryTable = {
  895. functionId: this.$route.meta.menuId,
  896. tableId: tableId,
  897. languageCode: this.$i18n.locale
  898. }
  899. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  900. if (!data.rows.length == 0) {
  901. switch (columnId) {
  902. case 1:
  903. this.columnList = data.rows
  904. break;
  905. // case 2:
  906. // this.columnDetailList = data.rows
  907. // break;
  908. // case 3:
  909. // this.columnList2 = data.rows
  910. // break;
  911. // case 4:
  912. // this.columnList3 = data.rows
  913. // break;
  914. }
  915. } else {
  916. // this.showDefault = true.
  917. }
  918. })
  919. },
  920. //获取按钮的权限数据
  921. getButtonAuthData () {
  922. let searchFlag = this.isAuth(this.menuId+":search")
  923. let saveFlag = this.isAuth(this.menuId+":save")
  924. let updateFlag = this.isAuth(this.menuId+":update")
  925. let deleteFlag = this.isAuth(this.menuId+":delete")
  926. //处理页面的权限数据
  927. this.authSearch = !searchFlag
  928. this.authSave = !saveFlag
  929. this.authUpdate = !updateFlag
  930. this.authDelete = !deleteFlag
  931. },
  932. }
  933. }
  934. </script>
  935. <style scoped>
  936. .el-table /deep/ .cell{
  937. height: auto;
  938. line-height: 1.5;
  939. }
  940. </style>