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.

949 lines
31 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
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
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="'类别编码'">
  12. <el-input v-model="searchData.familyID" style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'类别名称'">
  15. <el-input v-model="searchData.familyName" style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="' '">
  18. <el-button @click="doEmpty()">清空</el-button>
  19. <el-button type="primary" @click="getDataList()">查询</el-button>
  20. <el-button type="primary" @click="addModal()">新增</el-button>
  21. </el-form-item>
  22. <el-form-item :label="' '">
  23. <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
  24. <download-excel
  25. :fields="fields()"
  26. :data="exportData"
  27. type="xls"
  28. :name="exportName"
  29. :header="exportHeader"
  30. :footer="exportFooter"
  31. :fetch="createExportData"
  32. :before-generate="startDownload"
  33. :before-finish="finishDownload"
  34. worksheet="导出信息"
  35. class="el-button el-button--primary el-button--medium">
  36. {{ "导出" }}
  37. </download-excel>
  38. </el-form-item>
  39. </el-form>
  40. <!-- 展示列表 -->
  41. <el-table
  42. :height="height"
  43. :data="dataList"
  44. border
  45. v-loading="dataListLoading"
  46. style="width: 100%;">
  47. <el-table-column
  48. v-for="(item,index) in columnList" :key="index"
  49. :sortable="item.columnSortable"
  50. :prop="item.columnProp"
  51. :header-align="item.headerAlign"
  52. :show-overflow-tooltip="item.showOverflowTooltip"
  53. :align="item.align"
  54. :fixed="item.fixed==''?false:item.fixed"
  55. :min-width="item.columnWidth"
  56. :label="item.columnLabel">
  57. <template slot-scope="scope">
  58. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  59. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. fixed="right"
  64. header-align="center"
  65. align="center"
  66. width="160"
  67. label="操作">
  68. <template slot-scope="scope">
  69. <a type="text" size="small" @click="detailModal(scope.row)">检验模板</a>
  70. <a type="text" size="small" @click="deletePropertiesModel(scope.row)">删除</a>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <!-- 分页栏 -->
  75. <el-pagination
  76. @size-change="sizeChangeHandle"
  77. @current-change="currentChangeHandle"
  78. :current-page="pageIndex"
  79. :page-sizes="[20, 50, 100, 1000]"
  80. :page-size="pageSize"
  81. :total="totalPage"
  82. layout="total, sizes, prev, pager, next, jumper">
  83. </el-pagination>
  84. <!-- 类别属性新增/修改 -->
  85. <el-dialog title="类别属性设置" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
  86. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  87. <el-form-item >
  88. <span slot="label" style="" @click="getBaseList(1042)"><a herf="#">类别编码</a></span>
  89. <el-input v-model="modalData.familyID" style="width: 120px"></el-input>
  90. </el-form-item>
  91. <el-form-item label="类别名称:">
  92. <el-input v-model="modalData.familyName" disabled style="width: 120px"></el-input>
  93. </el-form-item>
  94. </el-form>
  95. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  96. <el-form-item label="备注:">
  97. <el-input v-model="modalData.attributeRemark" style="width: 120px"></el-input>
  98. </el-form-item>
  99. </el-form>
  100. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  101. <el-button type="primary" @click="saveData()">保存</el-button>
  102. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  103. </el-footer>
  104. </el-dialog>
  105. <!-- 检验模板 -->
  106. <el-dialog title="检验模板清单" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1500px">
  107. <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
  108. <el-form-item :label="'类别编码'">
  109. <el-input v-model="detailData.familyID" readonly style="width: 100px"></el-input>
  110. </el-form-item>
  111. <el-form-item :label="'类别名称'">
  112. <el-input v-model="detailData.familyName" readonly style="width: 220px"></el-input>
  113. </el-form-item>
  114. <el-form-item :label="' '">
  115. <el-button type="primary" @click="addFastModal()">新增</el-button>
  116. </el-form-item>
  117. </el-form>
  118. <!-- 检验项目展示列表 -->
  119. <div class="rq ">
  120. <el-table
  121. :height="300"
  122. :data="detailList"
  123. border
  124. v-loading="dataListLoading"
  125. style="width: 100%;">
  126. <el-table-column
  127. v-for="(item,index) in columnDetailList" :key="index"
  128. :sortable="item.columnSortable"
  129. :prop="item.columnProp"
  130. :header-align="item.headerAlign"
  131. :show-overflow-tooltip="item.showOverflowTooltip"
  132. :align="item.align"
  133. :fixed="item.fixed==''?false:item.fixed"
  134. :min-width="item.columnWidth"
  135. :label="item.columnLabel">
  136. <template slot-scope="scope">
  137. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  138. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column
  142. prop=""
  143. header-align="center"
  144. align="center"
  145. min-width="150"
  146. label="检验水平">
  147. <template slot-scope="scope">
  148. <el-button type="primary" @click="chooseLevel(scope.row)" style="width:35%" >点击选择</el-button>
  149. <el-input v-model="scope.row.samplingLevelDesc" readonly style="width:60%;"></el-input>
  150. </template>
  151. </el-table-column>
  152. <el-table-column
  153. prop=""
  154. header-align="center"
  155. align="center"
  156. min-width="60"
  157. label="检验周期(h)">
  158. <template slot-scope="scope">
  159. <el-input v-model="scope.row.inspectionCycle" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. prop=""
  164. header-align="center"
  165. align="center"
  166. min-width="150"
  167. label="抽样方案">
  168. <template slot-scope="scope">
  169. <el-button type="primary" @click="chooseProgrammeRow(scope.row)" style="width:35%" >点击选择</el-button>
  170. <el-input v-model="scope.row.samplingProgrammeDesc" readonly style="width:60%;"></el-input>
  171. </template>
  172. </el-table-column>
  173. <el-table-column
  174. prop=""
  175. header-align="center"
  176. align="center"
  177. min-width="60"
  178. label="AQL">
  179. <template slot-scope="scope">
  180. <el-input v-model="scope.row.aql" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. prop=""
  185. header-align="center"
  186. align="center"
  187. min-width="60"
  188. label="AC">
  189. <template slot-scope="scope">
  190. <el-input v-model="scope.row.ac" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  191. </template>
  192. </el-table-column>
  193. <el-table-column
  194. prop=""
  195. header-align="center"
  196. align="center"
  197. min-width="60"
  198. label="RE">
  199. <template slot-scope="scope">
  200. <el-input v-model="scope.row.re" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. fixed="right"
  205. header-align="center"
  206. align="center"
  207. width="80"
  208. label="操作">
  209. <template slot-scope="scope">
  210. <a type="text" size="small" @click="deletePartAttributeDetails(scope.row)">删除模板</a>
  211. </template>
  212. </el-table-column>
  213. </el-table>
  214. </div>
  215. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  216. <el-button type="primary" @click="saveDetail()">保存</el-button>
  217. <el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
  218. </el-footer>
  219. </el-dialog>
  220. <!-- 检验模板->快速新增 -->
  221. <el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="800px">
  222. <div style="font-size: 12px">
  223. <el-form :inline="true" label-position="top" :model="detailData">
  224. <el-form-item :label="'模板编码'">
  225. <el-input v-model="detailData.templateId" style="width: 120px"></el-input>
  226. </el-form-item>
  227. <el-form-item :label="'模板名称'">
  228. <el-input v-model="detailData.templateName" style="width: 120px"></el-input>
  229. </el-form-item>
  230. <el-form-item label="检验类型">
  231. <el-select v-model="detailData.inspectionTypeNo" placeholder="请选择">
  232. <el-option label="全部" value=""></el-option>
  233. <el-option
  234. v-for = "i in options"
  235. :key = "i.inspectionTypeNo"
  236. :label = "i.inspectionTypeName"
  237. :value = "i.inspectionTypeNo">
  238. </el-option>
  239. </el-select>
  240. </el-form-item>
  241. <el-form-item :label="' '">
  242. <el-button type="primary" @click="checkInspectionType()">查询</el-button>
  243. </el-form-item>
  244. </el-form>
  245. </div>
  246. <el-container style="margin-top: -12px;">
  247. <el-main style="width: 300px">
  248. <span style="font-size: 12px" >可选模板</span>
  249. <el-table
  250. height="300px"
  251. :data="itemList1"
  252. border
  253. @row-click="clickItem1"
  254. highlight-current-row
  255. v-loading="dataListLoading"
  256. style="width: 100%">
  257. <el-table-column
  258. prop="templateId"
  259. header-align="center"
  260. align="left"
  261. min-width="110"
  262. label="模板编码">
  263. </el-table-column>
  264. <el-table-column
  265. prop="templateName"
  266. header-align="center"
  267. align="left"
  268. min-width="170"
  269. label="模板名称">
  270. </el-table-column>
  271. </el-table>
  272. </el-main>
  273. <el-main style="width: 100px">
  274. <div style="margin-top: 100px">
  275. <el-button type="primary" @click="addItem()">添加>></el-button>
  276. </div>
  277. <div style="margin-top: 20px">
  278. <el-button type="primary" @click="deleteItem()">删除<<</el-button>
  279. </div>
  280. </el-main>
  281. <el-main style="width: 300px">
  282. <span style="font-size: 12px" >已有模板</span>
  283. <el-table
  284. height="300px"
  285. :data="itemList2"
  286. border
  287. @row-click="clickItem2"
  288. highlight-current-row
  289. v-loading="dataListLoading"
  290. style="width: 100%">
  291. <el-table-column
  292. prop="templateId"
  293. header-align="center"
  294. align="left"
  295. min-width="110"
  296. label="模板编码">
  297. </el-table-column>
  298. <el-table-column
  299. prop="templateName"
  300. header-align="center"
  301. align="left"
  302. min-width="170"
  303. label="模板名称">
  304. </el-table-column>
  305. </el-table>
  306. </el-main>
  307. </el-container>
  308. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  309. <el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
  310. </el-footer>
  311. </el-dialog>
  312. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  313. <!-- 导入 -->
  314. <qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
  315. </div>
  316. </template>
  317. <script>
  318. import {
  319. qcFamilyAttributeSearch, // 查询类别属性
  320. qcFamilyAttributeSave, // 新增类别属性
  321. qcFamilyAttributeDelete, // 删除类别属性
  322. InspectionTypeSearch, // 搜索所有检验类型
  323. savePartAttributeDetails, // 新增分类属性模板
  324. deletePartAttributeDetails, // 删除分类属性模板
  325. searchPartAttributeDetails, // 查询物料属性模板
  326. saveAttributeDetailed, // 新增物料属性模板详情
  327. getItemLists // 获取模板列表
  328. } from "@/api/qc/qc.js"
  329. import Chooselist from '@/views/modules/common/Chooselist_eam'
  330. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  331. import qcUpload from "./qc_upload";
  332. export default {
  333. components: {
  334. Chooselist,
  335. qcUpload
  336. },
  337. watch: {
  338. },
  339. data () {
  340. return {
  341. // 是否收藏
  342. favorite: false,
  343. // 导出 start
  344. exportData: [],
  345. exportName: "根据类别设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
  346. exportHeader: ["根据类别设置检验模板"],
  347. exportFooter: [],
  348. exportList:[],
  349. // 导出 end
  350. tagNo:'',
  351. searchData: {
  352. familyID: '',
  353. familyName: '',
  354. attributeType: 'B',
  355. page: 1,
  356. limit: 10,
  357. },
  358. height: 200,
  359. pageIndex: 1,
  360. pageSize: 100,
  361. totalPage: 0,
  362. // addDetailModalFlag:false,
  363. modalFlag:false,
  364. modalDisableFlag:false,
  365. modalData:{
  366. flag: '',
  367. familyID: '',
  368. familyName: '',
  369. supplierNo: '',
  370. supplierDesc: '',
  371. attributeRemark: '',
  372. createBy: this.$store.state.user.name,
  373. attributeType: 'B',
  374. },
  375. detailData:{
  376. site: this.$store.state.user.site,
  377. familyID: '',
  378. familyName: '',
  379. attributeNo: '',
  380. attributeType: 'B',
  381. inspectionTypeNo: '',
  382. templateId: '',
  383. templateName: '',
  384. createBy: this.$store.state.user.name
  385. },
  386. columnList: [
  387. {
  388. columnProp: 'familyID',
  389. headerAlign: "center",
  390. align: "left",
  391. columnLabel: '物料类别编码',
  392. columnHidden: false,
  393. columnImage: false,
  394. columnSortable: false,
  395. sortLv: 0,
  396. status: true,
  397. fixed: '',
  398. },
  399. {
  400. columnProp: 'familyName',
  401. headerAlign: "center",
  402. align: "left",
  403. columnLabel: '物料类别名称',
  404. columnHidden: false,
  405. columnImage: false,
  406. columnSortable: false,
  407. sortLv: 0,
  408. status: true,
  409. fixed: '',
  410. },
  411. {
  412. columnProp: 'attributeRemark',
  413. headerAlign: "center",
  414. align: "left",
  415. columnLabel: '备注',
  416. columnHidden: false,
  417. columnImage: false,
  418. columnSortable: false,
  419. sortLv: 0,
  420. status: true,
  421. fixed: '',
  422. },
  423. {
  424. columnProp: 'createTime',
  425. headerAlign: "center",
  426. align: "left",
  427. columnLabel: '操作时间',
  428. columnHidden: false,
  429. columnImage: false,
  430. columnSortable: false,
  431. sortLv: 0,
  432. status: true,
  433. fixed: '',
  434. },
  435. {
  436. columnProp: 'createBy',
  437. headerAlign: "center",
  438. align: "left",
  439. columnLabel: '操作人',
  440. columnHidden: false,
  441. columnImage: false,
  442. columnSortable: false,
  443. sortLv: 0,
  444. status: true,
  445. fixed: '',
  446. },
  447. ],
  448. detailModelFlag:false,
  449. detailList: [],
  450. dataListLoading: false,
  451. dataList:[],
  452. // 展示列集
  453. columnDetailList: [
  454. {
  455. columnProp: 'templateId',
  456. headerAlign: "center",
  457. align: "left",
  458. columnLabel: '模板编码',
  459. columnHidden: false,
  460. columnImage: false,
  461. columnSortable: false,
  462. sortLv: 0,
  463. status: true,
  464. fixed: '',
  465. },
  466. {
  467. columnProp: 'templateName',
  468. headerAlign: "center",
  469. align: "left",
  470. columnLabel: '模板名称',
  471. columnHidden: false,
  472. columnImage: false,
  473. columnSortable: false,
  474. sortLv: 0,
  475. status: true,
  476. fixed: '',
  477. },
  478. {
  479. columnProp: 'inspectionTypeName',
  480. headerAlign: "center",
  481. align: "left",
  482. columnLabel: '检验类型',
  483. columnHidden: false,
  484. columnImage: false,
  485. columnSortable: false,
  486. sortLv: 0,
  487. status: true,
  488. fixed: '',
  489. },
  490. {
  491. columnProp: 'templateRemark',
  492. headerAlign: "center",
  493. align: "left",
  494. columnLabel: '备注',
  495. columnHidden: false,
  496. columnImage: false,
  497. columnSortable: false,
  498. sortLv: 0,
  499. status: true,
  500. fixed: '',
  501. },
  502. {
  503. columnProp: 'templateVersion',
  504. headerAlign: "center",
  505. align: "left",
  506. columnLabel: '版本号',
  507. columnHidden: false,
  508. columnImage: false,
  509. columnSortable: false,
  510. sortLv: 0,
  511. status: true,
  512. fixed: '',
  513. },
  514. ],
  515. // 快速添加
  516. fastAddFlag:false,
  517. itemList1:[],
  518. itemList2:[],
  519. itemListRow1:{},
  520. itemListRow2:{},
  521. options: [],
  522. tempProgrammeRow:'',
  523. }
  524. },
  525. mounted () {
  526. this.$nextTick(() => {
  527. this.height = window.innerHeight - 210
  528. })
  529. },
  530. created () {
  531. this.getDataList()
  532. this.favoriteIsOk()
  533. },
  534. methods: {
  535. // 查询检验类型
  536. InspectionTypeSearch(){
  537. InspectionTypeSearch().then(({data}) => {
  538. if (data.code === 0) {
  539. this.options = data.rows
  540. }
  541. })
  542. },
  543. // 清空搜索栏
  544. doEmpty(){
  545. this.searchData = {
  546. codeNo: '',
  547. codeDesc: '',
  548. active:'',
  549. familyName:'',
  550. functionType:'D',
  551. inspectionTypeName:'',
  552. page: 1,
  553. limit: 10,
  554. }
  555. },
  556. chooseLevel(row){
  557. this.tempLevelRow = row;
  558. this.getBaseList(1048);
  559. },
  560. chooseProgrammeRow(row){
  561. this.tempProgrammeRow = row;
  562. this.getBaseList(1051);
  563. },
  564. // 获取基础数据列表S
  565. getBaseList (val,type) {
  566. this.tagNo = val
  567. this.$nextTick(() => {
  568. let strVal = ''
  569. if (val === 1042) {
  570. strVal = this.modalData.familyID
  571. this.$refs.baseList.init(val, strVal)
  572. }
  573. if (val === 1048) {
  574. strVal = this.tempLevelRow.samplingLevelNo
  575. this.$refs.baseList.init(val, strVal)
  576. }
  577. if (val === 1051) {
  578. strVal = this.tempProgrammeRow.samplingProgrammeNo
  579. this.$refs.baseList.init(val, strVal)
  580. }
  581. })
  582. },
  583. /* 列表方法的回调 */
  584. getBaseData (val) {
  585. if (this.tagNo === 1042) {
  586. this.modalData.familyID = val.FamilyID
  587. this.modalData.familyName = val.FamilyName
  588. }
  589. if (this.tagNo === 1048) {
  590. this.tempLevelRow.samplingLevelNo = val.sampling_level_no
  591. this.tempLevelRow.samplingLevelDesc = val.sampling_level_desc
  592. }
  593. if (this.tagNo === 1051) {
  594. this.tempProgrammeRow.samplingProgrammeNo = val.sampling_programme_no
  595. this.tempProgrammeRow.samplingProgrammeDesc = val.sampling_programme_desc
  596. }
  597. },
  598. // 获取数据列表
  599. getDataList () {
  600. this.searchData.limit = this.pageSize
  601. this.searchData.page = this.pageIndex
  602. qcFamilyAttributeSearch(this.searchData).then(({data}) => {
  603. if (data.code == 0) {
  604. this.dataList = data.page.list
  605. this.pageIndex = data.page.currPage
  606. this.pageSize = data.page.pageSize
  607. this.totalPage = data.page.totalCount
  608. }
  609. this.dataListLoading = false
  610. })
  611. },
  612. // 每页数
  613. sizeChangeHandle (val) {
  614. this.pageSize = val
  615. this.pageIndex = 1
  616. this.getDataList()
  617. },
  618. // 当前页
  619. currentChangeHandle (val) {
  620. this.pageIndex = val
  621. this.getDataList()
  622. },
  623. addModal(){
  624. this.modalData={
  625. flag: '1',
  626. familyID: '',
  627. familyName: '',
  628. supplierNo: '',
  629. supplierDesc: '',
  630. attributeRemark: '',
  631. createBy: this.$store.state.user.name,
  632. attributeType: 'B',
  633. };
  634. this.modalDisableFlag = false;
  635. this.modalFlag = true;
  636. },
  637. // 删除
  638. deletePropertiesModel (row) {
  639. this.$confirm(`是否删除这个分类属性?`, '提示', {
  640. confirmButtonText: '确定',
  641. cancelButtonText: '取消',
  642. type: 'warning'
  643. }).then(() => {
  644. qcFamilyAttributeDelete(row).then(({data}) => {
  645. if (data && data.code === 0) {
  646. this.getDataList()
  647. this.$message({
  648. message: '操作成功',
  649. type: 'success',
  650. duration: 1500,
  651. onClose: () => {
  652. }
  653. })
  654. } else {
  655. this.$alert(data.msg, '错误', {
  656. confirmButtonText: '确定'
  657. })
  658. }
  659. })
  660. }).catch(() => {
  661. })
  662. },
  663. saveData(){
  664. if (this.modalData.familyID == '' || this.modalData.familyID == null) {
  665. this.$alert('请选择物料分类编码!', '错误', {
  666. confirmButtonText: '确定'
  667. })
  668. return false
  669. }
  670. if (this.modalData.familyName == '' || this.modalData.familyName == null) {
  671. this.$alert('请选择物料分类名称!', '错误', {
  672. confirmButtonText: '确定'
  673. })
  674. return false
  675. }
  676. if(this.modalData.flag=='1'){
  677. qcFamilyAttributeSave(this.modalData).then(({data}) => {
  678. if (data && data.code === 0) {
  679. this.getDataList()
  680. this.modalFlag=false
  681. this.$message({
  682. message: '操作成功',
  683. type: 'success',
  684. duration: 1500,
  685. onClose: () => {
  686. }
  687. })
  688. } else {
  689. this.$alert(data.msg, '错误', {
  690. confirmButtonText: '确定'
  691. })
  692. }
  693. })
  694. }
  695. },
  696. // 保存属性模板
  697. saveDetail(){
  698. for (let i = 0; i < this.detailList.length; i++) {
  699. saveAttributeDetailed(this.detailList[i]).then(({data}) => {
  700. if (data && data.code === 0) {
  701. this.getDataList()
  702. this.detailModelFlag = false
  703. this.$message({
  704. message: '操作成功',
  705. type: 'success',
  706. duration: 1500,
  707. onClose: () => {
  708. }
  709. })
  710. } else {
  711. this.$alert(data.msg, '错误', {
  712. confirmButtonText: '确定'
  713. }).then(() => {
  714. return false
  715. })
  716. }
  717. })
  718. }
  719. },
  720. //打开分类模板清单
  721. detailModal(row){
  722. this.detailData.familyID = row.familyID
  723. this.detailData.attributeNo = row.familyID
  724. this.detailData.partDesc = row.partDesc
  725. searchPartAttributeDetails(this.detailData).then(({data}) => {
  726. this.detailList = data.rows
  727. })
  728. this.detailModelFlag = true;
  729. },
  730. // // 普通新增
  731. // addDetailModal(){
  732. // this.detailData.itemNo = '';
  733. // this.detailData.itemDesc = '';
  734. // this.addDetailModalFlag = true;
  735. // },
  736. checkInspectionType(){
  737. getItemLists(this.detailData).then(({data}) => {
  738. this.itemList1 = data.row1;
  739. this.itemList2 = data.row2;
  740. })
  741. },
  742. // 快速新增
  743. addFastModal(){
  744. this.itemListRow2 = null
  745. this.itemListRow1 = null
  746. this.InspectionTypeSearch()
  747. getItemLists(this.detailData).then(({data}) => {
  748. this.itemList1 = data.row1;
  749. this.itemList2 = data.row2;
  750. })
  751. this.fastAddFlag = true;
  752. },
  753. clickItem1(row){
  754. this.itemListRow1 = JSON.parse(JSON.stringify(row));
  755. },
  756. clickItem2(row){
  757. this.itemListRow2 = JSON.parse(JSON.stringify(row));
  758. },
  759. // 添加模板
  760. addItem(){
  761. if(this.itemListRow1 == null){
  762. this.$alert("请选择可选模板!", '错误', {
  763. confirmButtonText: '确定'
  764. })
  765. return false;
  766. }
  767. let inData={
  768. attributeNo: this.detailData.familyID,
  769. templateId: this.itemListRow1.templateId,
  770. attributeType: this.detailData.attributeType,
  771. site: this.$store.state.user.site
  772. }
  773. savePartAttributeDetails(inData).then(({data}) => {
  774. if (data && data.code == 0) {
  775. getItemLists(this.detailData).then(({data}) => {
  776. this.itemList1=data.row1;
  777. this.itemList2=data.row2;
  778. })
  779. this.itemListRow1=null
  780. } else {
  781. this.$alert(data.msg, '错误', {
  782. confirmButtonText: '确定'
  783. })
  784. }
  785. })
  786. },
  787. // 删除项目
  788. deleteItem(){
  789. if(this.itemListRow2 == null){
  790. this.$alert("请选择已选模板!", '错误', {
  791. confirmButtonText: '确定'
  792. })
  793. return false;
  794. }
  795. let inData = {
  796. attributeNo:this.detailData.familyID,
  797. templateId: this.itemListRow2.templateId,
  798. site:this.$store.state.user.site
  799. }
  800. deletePartAttributeDetails(inData).then(({data}) => {
  801. if (data && data.code === 0) {
  802. getItemLists(this.detailData).then(({data}) => {
  803. this.itemList1 = data.row1;
  804. this.itemList2 = data.row2;
  805. })
  806. this.itemListRow2 = null
  807. } else {
  808. this.$alert(data.msg, '错误', {
  809. confirmButtonText: '确定'
  810. })
  811. }
  812. })
  813. },
  814. // 关闭后刷新列表
  815. refreshDetailList(){
  816. searchPartAttributeDetails(this.detailData).then(({data}) => {
  817. this.detailList = data.rows
  818. })
  819. },
  820. // 删除物料属性中的模板
  821. deletePartAttributeDetails(row){
  822. this.$confirm(`是否删除这个检验模板?`, '提示', {
  823. confirmButtonText: '确定',
  824. cancelButtonText: '取消',
  825. type: 'warning'
  826. }).then(() => {
  827. deletePartAttributeDetails(row).then(({data}) => {
  828. if (data && data.code === 0) {
  829. searchPartAttributeDetails(this.detailData).then(({data}) => {
  830. this.detailList = data.rows
  831. })
  832. this.$message({
  833. message: '操作成功',
  834. type: 'success',
  835. duration: 1500,
  836. onClose: () => {
  837. }
  838. })
  839. } else {
  840. this.$alert(data.msg, '错误', {
  841. confirmButtonText: '确定'
  842. })
  843. }
  844. })
  845. }).catch(() => {
  846. })
  847. },
  848. // 校验用户是否收藏
  849. favoriteIsOk() {
  850. let userFavorite = {
  851. userId: this.$store.state.user.id,
  852. languageCode: this.$i18n.locale
  853. }
  854. console.log(this.$route.meta.menuId)
  855. userFavoriteList(userFavorite).then(({data}) => {
  856. for (let i = 0; i < data.list.length; i++) {
  857. // let flag=false;
  858. if(this.$route.meta.menuId==data.list[i].menuId){
  859. this.favorite = true
  860. // flag=true;
  861. }
  862. }
  863. })
  864. },
  865. // 收藏 OR 取消收藏
  866. favoriteFunction() {
  867. let userFavorite = {
  868. userId: this.$store.state.user.id,
  869. functionId: this.$route.meta.menuId,
  870. }
  871. if (this.favorite) {
  872. // 取消收藏
  873. this.$confirm(`确定取消收藏`, '提示', {
  874. confirmButtonText: '确定',
  875. cancelButtonText: '取消',
  876. type: 'warning'
  877. }).then(() => {
  878. removeUserFavorite(userFavorite).then(({data}) => {
  879. this.$message.success(data.msg)
  880. this.favorite = false
  881. })
  882. })
  883. } else {
  884. // 收藏
  885. saveUserFavorite(userFavorite).then(({data}) => {
  886. this.$message.success(data.msg)
  887. this.favorite = true
  888. })
  889. }
  890. },
  891. //导出excel
  892. async createExportData() {
  893. this.searchData.limit = -1
  894. this.searchData.page = 1
  895. await qcFamilyAttributeSearch(this.searchData).then(({data}) => {
  896. this.exportList= data.page.list;
  897. })
  898. return this.exportList;
  899. },
  900. startDownload() {
  901. // this.exportData = this.dataList
  902. },
  903. finishDownload() {
  904. },
  905. fields() {
  906. let json = "{"
  907. this.columnList.forEach((item, index) => {
  908. if (index == this.columnList.length - 1) {
  909. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  910. } else {
  911. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  912. }
  913. })
  914. json += "}"
  915. let s = eval("(" + json + ")")
  916. return s
  917. },
  918. // 导出 end
  919. // 导入
  920. qcUpload(){
  921. let currentData = {
  922. flag: 'familyAttribute',
  923. createBy: this.$store.state.user.name,
  924. site: this.$store.state.user.site,
  925. };
  926. //打开组件 去做新增业务
  927. this.$nextTick(() => {
  928. this.$refs.qcUpload.init(currentData);
  929. })
  930. },
  931. }
  932. }
  933. </script>