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.

1623 lines
52 KiB

4 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-row>
  4. <el-col :span="24">
  5. <div>
  6. <span @click="favoriteFunction()">
  7. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  8. </span>
  9. </div>
  10. <el-button @click="getDataList('Y')" type="primary">{{ buttons.search }}</el-button>
  11. <el-button @click="initAddModel(null)" type="primary">{{ buttons.addLabelName }}</el-button>
  12. <download-excel
  13. :fields="fields()"
  14. :data="exportData"
  15. type="xls"
  16. :name="exportName"
  17. :header="exportHeader"
  18. :footer="exportFooter"
  19. :defaultValue="exportDefaultValue"
  20. :fetch="createExportData"
  21. :before-generate="startDownload"
  22. :before-finish="finishDownload"
  23. worksheet="导出信息"
  24. class="el-button el-button--primary el-button--medium">
  25. {{ buttons.download }}
  26. </download-excel>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="24">
  31. <el-form :inline="true" label-position="top">
  32. <el-form-item :label="'创建日期'">
  33. <el-date-picker
  34. style="width: 110px"
  35. v-model="mainQueryData.startDate"
  36. type="date"
  37. format="yyyy-MM-dd"
  38. value-format="yyyy-MM-dd"
  39. placeholder="选择日期">
  40. </el-date-picker>
  41. -
  42. <el-date-picker
  43. style="width: 110px"
  44. v-model="mainQueryData.endDate"
  45. type="date"
  46. format="yyyy-MM-dd"
  47. value-format="yyyy-MM-dd 23:59:59"
  48. placeholder="选择日期">
  49. </el-date-picker>
  50. </el-form-item>
  51. <el-form-item :label="inputSearch1">
  52. <el-input style="width: 100px;" clearable placeholder="" v-model="mainQueryData.requisitionno"></el-input>
  53. </el-form-item>
  54. <el-form-item :label="inputSearch3">
  55. <el-input style="width: 100px;" clearable placeholder="" v-model="mainQueryData.partno"></el-input>
  56. </el-form-item>
  57. <el-form-item :label="'刀模名称'">
  58. <el-input style="width: 100px;" clearable placeholder="" v-model="mainQueryData.familyName"></el-input>
  59. </el-form-item>
  60. <el-form-item :label="'工具类型'">
  61. <el-select v-model="mainQueryData.orderref1" placeholder="请选择" style="width: 120px;">
  62. <el-option value="" label="全部"></el-option>
  63. <el-option
  64. v-for="item in selectList.select1"
  65. :key="item.familyID"
  66. :label="item.familyName"
  67. :value="item.familyID">
  68. </el-option>
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item>
  72. <span slot="label" @click="getBaseList(3,1)"><el-link>{{ '供应商编码' }}</el-link> </span>
  73. <el-input v-model="mainQueryData.supplierid" onkeyup="this.value = this.value.toUpperCase()"
  74. style="width: 120px"></el-input>
  75. </el-form-item>
  76. <el-form-item :label="inputSearch2">
  77. <el-select v-model="mainQueryData.orderType" placeholder="请选择" filterable style="width: 100px">
  78. <el-option
  79. key=""
  80. label="全部"
  81. value="">
  82. </el-option>
  83. <el-option
  84. v-for="(item,index) in auditTypeList"
  85. :key="index"
  86. :label="item.roleDesc"
  87. :value="item.roleItemNo">
  88. </el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item :label="inputSearch4">
  92. <el-select v-model="mainQueryData.authorizeFlag" style="width: 90px;">
  93. <el-option value="" label="全部"></el-option>
  94. <el-option value="Y" label="已审批"></el-option>
  95. <el-option value="N" label="未审批"></el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item :label="inputSearch12">
  99. <el-select v-model="mainQueryData.approveresult" style="width: 110px;">
  100. <el-option value="" label="全部"></el-option>
  101. <el-option value="审批通过" label="审批通过"></el-option>
  102. <el-option value="审批中" label="审批中"></el-option>
  103. <el-option value="审批未通过" label="审批未通过"></el-option>
  104. </el-select>
  105. </el-form-item>
  106. </el-form>
  107. </el-col>
  108. </el-row>
  109. <el-row>
  110. <el-col :span="24">
  111. <el-table
  112. :height="height"
  113. :data="dataList"
  114. border
  115. v-loading="dataListLoading"
  116. @selection-change="selectionChangeHandle"
  117. style="width: 100%;">
  118. <el-table-column
  119. v-for="(item,index) in columnList" :key="index"
  120. :sortable="item.columnSortable"
  121. :prop="item.columnProp"
  122. :header-align="item.headerAlign"
  123. :show-overflow-tooltip="item.showOverflowTooltip"
  124. :align="item.align"
  125. :fixed="item.fixed==''?false:item.fixed"
  126. :width="item.columnWidth"
  127. :label="item.columnLabel">
  128. <template slot-scope="scope">
  129. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  130. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  131. style="width: 100px; height: 80px"/></span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. fixed="right"
  136. header-align="center"
  137. align="center"
  138. width="120"
  139. :label="buttons.operating">
  140. <template slot-scope="scope">
  141. <a v-if="scope.row.authorizeFlag == 'N'" @click="initAddModel(scope.row)">{{ buttons.edit }}</a>
  142. <a v-if="scope.row.authorizeFlag == 'N'" @click="updateAuthorizeFlag(scope.row)">{{ buttons.close }}</a>
  143. <a
  144. v-if="scope.row.authorizeFlag == 'Y' && scope.row.approvedFlag != 'Y' && scope.row.approveresult == '审批未通过'"
  145. @click="initReapply(scope.row)">{{ buttons.reapply }}</a>
  146. <a @click="initReviewDetails(scope.row.requisitionno)">{{ buttons.reviewDetails }}</a>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <el-pagination
  151. @size-change="sizeChangeHandle"
  152. @current-change="currentChangeHandle"
  153. :current-page="pageIndex"
  154. :page-sizes="[10, 50, 200, 10000]"
  155. :page-size="pageSize"
  156. :total="totalPage"
  157. layout="total, sizes, prev, pager, next, jumper">
  158. </el-pagination>
  159. </el-col>
  160. </el-row>
  161. <!-- 设置列 -->
  162. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  163. <el-dialog title="申请单信息" :visible.sync="addPRDetailFlag" width="760px" :close-on-click-modal="false"
  164. :close-on-press-escape="false" v-drag>
  165. <el-row>
  166. <el-col :span="24">
  167. <el-form class="sxm" :inline="true" label-position="top">
  168. <el-form-item :label="inputSearch5">
  169. <el-select v-model="currentPRDetailData.orderType" filterable style="width: 120px">
  170. <el-option
  171. v-for="(item,index) in auditTypeList"
  172. :key="index"
  173. :label="item.roleDesc"
  174. :value="item.roleItemNo">
  175. </el-option>
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item>
  179. <span slot="label" @click="getBaseList(3)"><el-link>{{ '供应商编码' }}</el-link> </span>
  180. <el-input v-model="currentPRDetailData.supplierid"
  181. style="width: 120px"></el-input>
  182. </el-form-item>
  183. <el-form-item :label="'供应商名称'">
  184. <el-input class="customer-input-color-red" v-model="currentPRDetailData.suppliername" readonly
  185. style="width: 180px"></el-input>
  186. </el-form-item>
  187. <el-form-item :label="'预估单价'">
  188. <el-input style="text-align: left;width: 120px" v-model="currentPRDetailData.price" @change="getNumber()"
  189. oninput="value=value.replace(/^\.+|[^\d.]/g,'')"></el-input>
  190. </el-form-item>
  191. <el-form-item :label="'申请数量'">
  192. <el-input style="text-align: left;width: 120px" @change="getNumber()"
  193. oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
  194. v-model="currentPRDetailData.qty"></el-input>
  195. </el-form-item>
  196. <el-form-item :label="'工具类型'">
  197. <el-select v-model="currentPRDetailData.orderref1" placeholder="请选择" style="width: 120px;">
  198. <el-option
  199. v-for="item in selectList.select1"
  200. :key="item.familyID"
  201. :label="item.familyName"
  202. :value="item.familyID">
  203. </el-option>
  204. </el-select>
  205. </el-form-item>
  206. <el-form-item :label="'工具编码'">
  207. <span v-if="showToolIdList" slot="label" @click="getBaseList(70)"><el-link>{{
  208. '工具编码'
  209. }}</el-link> </span>
  210. <span v-else="showToolIdList" slot="label">{{ '工具编码' }}</span>
  211. <el-input style="text-align: left;width: 120px"
  212. v-model="currentPRDetailData.partno"></el-input>
  213. </el-form-item>
  214. <el-form-item :label="'工具名称'">
  215. <el-input style="text-align: left;width: 180px"
  216. :readonly="showToolIdList"
  217. :class="showToolIdList?'customer-input-color-red':''"
  218. v-model="currentPRDetailData.partdesc"></el-input>
  219. </el-form-item>
  220. <el-form-item :label="'预估总价'">
  221. <el-input class="customer-input-color-red" style="text-align: right;width: 120px"
  222. v-model="currentPRDetailData.totalPrice"
  223. :disabled="true"></el-input>
  224. </el-form-item>
  225. <el-form-item v-if="addFlagShow" :label="'是否新增'">
  226. <el-radio v-model="currentPRDetailData.addFlag" label="1"></el-radio>
  227. <el-radio v-model="currentPRDetailData.addFlag" label="2"></el-radio>
  228. </el-form-item>
  229. <el-form-item :label="'寿命'">
  230. <el-input oninput="value=value.replace(/^\.+|[^\d.]/g,'')" style="text-align: right;width: 120px"
  231. v-model="currentPRDetailData.lifespan"
  232. ></el-input>
  233. </el-form-item>
  234. <el-form-item :label="'实例号'">
  235. <el-input style="text-align: right;width: 120px"
  236. v-model="currentPRDetailData.toolInstanceId"
  237. ></el-input>
  238. </el-form-item>
  239. <el-form-item :label="'备注'">
  240. <el-input style="text-align: right;width: 315px"
  241. v-model="currentPRDetailData.remark"
  242. ></el-input>
  243. </el-form-item>
  244. </el-form>
  245. </el-col>
  246. </el-row>
  247. <el-row>
  248. <el-col :span="24">
  249. <upload v-on:childByValue="childByValue"></upload>
  250. <el-table
  251. height="200"
  252. :data="fileList"
  253. border
  254. v-loading="dataListLoading"
  255. @selection-change="selectionChangeHandle"
  256. style="width: 100%;">
  257. <el-table-column
  258. v-for="(item,index) in columnList2" :key="index"
  259. :sortable="item.columnSortable"
  260. :prop="item.columnProp"
  261. :header-align="item.headerAlign"
  262. :show-overflow-tooltip="item.showOverflowTooltip"
  263. :align="item.align"
  264. :fixed="item.fixed==''?false:item.fixed"
  265. :width="item.columnWidth"
  266. :label="item.columnLabel">
  267. <template slot-scope="scope">
  268. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  269. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  270. style="width: 100px; height: 80px"/></span>
  271. </template>
  272. </el-table-column>
  273. <el-table-column
  274. header-align="center"
  275. align="center"
  276. width="80"
  277. :label="buttons.operating">
  278. <template slot-scope="scope">
  279. <a @click="fileDownload(scope.row)">{{ buttons.fileDownload }}</a>
  280. <a @click="filePreview(scope.row)">{{ buttons.preview }}</a>
  281. <a @click="delFile(scope.row)">{{ buttons.delete }}</a>
  282. </template>
  283. </el-table-column>
  284. </el-table>
  285. </el-col>
  286. </el-row>
  287. <span slot="footer" class="dialog-footer">
  288. <el-button type="primary" :disabled="bannersBut" @click="savePRDetail()">确定</el-button>
  289. <el-button type="primary" @click="addPRDetailFlag = false">取消</el-button>
  290. </span>
  291. </el-dialog>
  292. <el-dialog title="申请单审核" :visible.sync="reviewDetailsFlag" width="1208px" :close-on-click-modal="false"
  293. v-drag>
  294. <el-table
  295. :height="height"
  296. :data="reviewDetailsList"
  297. border
  298. v-loading="dataListLoading"
  299. @selection-change="selectionChangeHandle"
  300. style="width: 100%;">
  301. <el-table-column
  302. v-for="(item,index) in columnList1" :key="index"
  303. :sortable="item.columnSortable"
  304. :prop="item.columnProp"
  305. :header-align="item.headerAlign"
  306. :show-overflow-tooltip="item.showOverflowTooltip"
  307. :align="item.align"
  308. :fixed="item.fixed==''?false:item.fixed"
  309. :width="item.columnWidth"
  310. :label="item.columnLabel">
  311. <template slot-scope="scope">
  312. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  313. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  314. style="width: 100px; height: 80px"/></span>
  315. </template>
  316. </el-table-column>
  317. </el-table>
  318. </el-dialog>
  319. <el-dialog title="预览" :visible.sync="pdfVisible" center width="60%">
  320. <iframe :src="this.pdfUrl" frameborder="0" width="100%" height="400px"></iframe>
  321. </el-dialog>
  322. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  323. </div>
  324. </template>
  325. <script>
  326. import Chooselist from '@/views/modules/common/Chooselist'
  327. import column from "../common/column";
  328. import {
  329. searchSysLanguagePackList,
  330. searchSysLanguageParam,
  331. searchFunctionButtonList,
  332. saveButtonList,
  333. searchSysLanguage,
  334. searchLanguageListByLanguageCode,
  335. saveSysLanguageOne
  336. } from "@/api/sysLanguage.js"
  337. import {
  338. saveTableDefaultList,
  339. saveTableUser,
  340. getTableDefaultListLanguage,
  341. getTableUserListLanguage,
  342. removerDefault,
  343. removerUser
  344. } from "@/api/table.js"
  345. import {
  346. userFavoriteList, saveUserFavorite, removeUserFavorite
  347. } from '@/api/userFavorite.js'
  348. import {
  349. getPRHeaderList,
  350. getTblBaseDataList,
  351. savePRDetail,
  352. getSupplierList,
  353. getExportList,
  354. authorizationHistList,
  355. updatePRHeaderAuthorizeFlag,
  356. downFtpFile,
  357. getFileList,
  358. getPartFamilyList,
  359. delFileAssociate,
  360. } from '@/api/purchaseorder/purchaseRequisition.js'
  361. import {
  362. getBusinessRoleList,
  363. } from '@/api/auditManagement/auditRules.js'
  364. import upload from "../common/upload";
  365. import axios from "axios";
  366. import Vue from "vue";
  367. export default {
  368. components: {
  369. upload,
  370. Chooselist,
  371. column
  372. },
  373. data() {
  374. return {
  375. number: 0,
  376. auditTypeList: [],
  377. //模态框编码
  378. tagNo: "",
  379. pdfUrl: '',
  380. insertFileList: [],
  381. fileList: [],
  382. // table 高度
  383. height: 0,
  384. bannersBut: false,
  385. addPRDetailFlag: false,
  386. inputSearch1: '申请单号',
  387. inputSearch2: '业务类型',
  388. inputSearch3: '工具编码',
  389. inputSearch4: '是否审批',
  390. inputSearch5: '业务类型',
  391. inputSearch6: '工具编码',
  392. inputSearch7: '申请数量',
  393. inputSearch8: '预估单价',
  394. inputSearch9: '预估总价',
  395. inputSearch10: '供应商编码',
  396. inputSearch11: '刀模名称',
  397. inputSearch12: '审批状态',
  398. inputSearch13: '工具类型',
  399. currentPRDetailData: {
  400. username: this.$store.state.user.name,
  401. requisitionno: '',
  402. site: this.$store.state.user.site,
  403. itemno: '',
  404. supplierid: '',
  405. suppliername: '',
  406. orderType: '',
  407. partno: '',
  408. partdesc: '',
  409. qty: 0,
  410. price: 0,
  411. totalPrice: 0,
  412. convertFactor: 0,
  413. currency: '',
  414. status: '',
  415. taxcode: '',
  416. currencyRate: 1,
  417. additionalCose: 0,
  418. orderref1: '',
  419. orderref2: '',
  420. sysOssEntityList: [],
  421. addFlag: '',
  422. lifespan: '',
  423. toolInstanceId: '',
  424. remark: ''
  425. },
  426. mainQueryData: {
  427. startDate: '',
  428. endDate: '',
  429. requisitionno: '',
  430. orderType: '',
  431. partno: '',
  432. authorizeFlag: '',
  433. approveresult: '',
  434. site: this.$store.state.user.site,
  435. strUserId: this.$store.state.user.id,
  436. limit: '',
  437. page: '',
  438. orderref1: '',
  439. familyName: '',
  440. supplierid: ''
  441. },
  442. selectList: {
  443. select1: [],
  444. },
  445. userId: this.$store.state.user.name,
  446. site: this.$store.state.user.site,
  447. //审核详情
  448. reviewDetailsFlag: false,
  449. //审核显示list
  450. reviewDetailsList: [],
  451. // 是否收藏
  452. favorite: false,
  453. addLanguage: false,
  454. pdfVisible: false,
  455. functionId: this.$route.meta.menuId,
  456. tableId: this.$route.meta.menuId + 'PR01',
  457. value1: true,
  458. visible: false,
  459. showDefault: false,
  460. addFlagShow: true,
  461. // 默认table 查询参数
  462. queryTable: {
  463. functionId: this.$route.meta.menuId,
  464. tableId: this.$route.meta.menuId + 'PR01',
  465. languageCode: this.$i18n.locale
  466. },
  467. // 用户table 查询参数
  468. queryTableUser: {
  469. userId: this.$store.state.user.name,
  470. functionId: this.$route.meta.menuId,
  471. tableId: this.$route.meta.menuId + 'PR01',
  472. status: true,
  473. languageCode: this.$i18n.locale
  474. },
  475. // 语言词典查询参数
  476. querySysLanguageParam: {
  477. languageCode: this.$i18n.locale
  478. },
  479. // 语言词典集合
  480. sysLanguageParams: [],
  481. // 用户table 配置集合
  482. userColumnList: [],
  483. // 展示列集
  484. columnList: [
  485. {
  486. userId: this.$store.state.user.name,
  487. serialNumber: 'PRHeader2001RequisitionNo',
  488. tableId: this.$route.meta.menuId + 'PR01',
  489. tableName: "PRHeader",
  490. columnProp: "requisitionno",
  491. headerAlign: "center",
  492. align: "center",
  493. columnLabel: "申请单号",
  494. columnHidden: false,
  495. columnImage: false,
  496. columnSortable: false,
  497. sortLv: 0,
  498. status: true,
  499. fixed: false
  500. },
  501. {
  502. userId: this.$store.state.user.name,
  503. serialNumber: 'PRHeader2001OrderType',
  504. tableId: this.$route.meta.menuId + 'PR01',
  505. tableName: "PRHeader",
  506. columnProp: "orderType",
  507. headerAlign: "center",
  508. align: "center",
  509. columnLabel: "处理类型",
  510. columnHidden: false,
  511. columnImage: false,
  512. columnSortable: false,
  513. sortLv: 0,
  514. status: true,
  515. fixed: false
  516. },
  517. {
  518. userId: this.$store.state.user.name,
  519. serialNumber: 'PRHeader2001Partno',
  520. tableId: this.$route.meta.menuId + 'PR01',
  521. tableName: "PRHeader",
  522. columnProp: "partno",
  523. headerAlign: "center",
  524. align: "center",
  525. columnLabel: "刀模编码",
  526. columnHidden: false,
  527. columnImage: false,
  528. columnSortable: false,
  529. sortLv: 0,
  530. status: true,
  531. fixed: false
  532. },
  533. {
  534. userId: this.$store.state.user.name,
  535. serialNumber: 'PRHeader2001Partdesc',
  536. tableId: this.$route.meta.menuId + 'PR01',
  537. tableName: "PRHeader",
  538. columnProp: "partdesc",
  539. headerAlign: "center",
  540. align: "center",
  541. columnLabel: "刀模名称",
  542. columnHidden: false,
  543. columnImage: false,
  544. columnSortable: false,
  545. sortLv: 0,
  546. status: true,
  547. fixed: false
  548. },
  549. {
  550. userId: this.$store.state.user.name,
  551. serialNumber: 'PRHeader2001Qty',
  552. tableId: this.$route.meta.menuId + 'PR01',
  553. tableName: "PRHeader",
  554. columnProp: "qty",
  555. headerAlign: "center",
  556. align: "right",
  557. columnLabel: "申请数量",
  558. columnHidden: false,
  559. columnImage: false,
  560. columnSortable: false,
  561. sortLv: 0,
  562. status: true,
  563. fixed: false
  564. },
  565. {
  566. userId: this.$store.state.user.name,
  567. serialNumber: 'PRHeader2001Price',
  568. tableId: this.$route.meta.menuId + 'PR01',
  569. tableName: "PRHeader",
  570. columnProp: "price",
  571. headerAlign: "center",
  572. align: "center",
  573. columnLabel: "预估价格",
  574. columnHidden: false,
  575. columnImage: false,
  576. columnSortable: false,
  577. sortLv: 0,
  578. status: true,
  579. fixed: false
  580. },
  581. {
  582. userId: this.$store.state.user.name,
  583. serialNumber: 'PRHeader2001TotalPrice',
  584. tableId: this.$route.meta.menuId + 'PR01',
  585. tableName: "PRHeader",
  586. columnProp: "totalPrice",
  587. headerAlign: "center",
  588. align: "center",
  589. columnLabel: "预估总价",
  590. columnHidden: false,
  591. columnImage: false,
  592. columnSortable: false,
  593. sortLv: 0,
  594. status: true,
  595. fixed: false
  596. },
  597. {
  598. userId: this.$store.state.user.name,
  599. serialNumber: 'PRHeader2001Supplierid',
  600. tableId: this.$route.meta.menuId + 'PR01',
  601. tableName: "PRHeader",
  602. columnProp: "supplierid",
  603. headerAlign: "center",
  604. align: "center",
  605. columnLabel: "供应商编码",
  606. columnHidden: false,
  607. columnImage: false,
  608. columnSortable: false,
  609. sortLv: 0,
  610. status: true,
  611. fixed: false
  612. },
  613. {
  614. userId: this.$store.state.user.name,
  615. serialNumber: 'PRHeader2001Suppliername',
  616. tableId: this.$route.meta.menuId + 'PR01',
  617. tableName: "PRHeader",
  618. columnProp: "suppliername",
  619. headerAlign: "center",
  620. align: "center",
  621. columnLabel: "供应商名称",
  622. columnHidden: false,
  623. columnImage: false,
  624. columnSortable: false,
  625. sortLv: 0,
  626. status: true,
  627. fixed: false
  628. },
  629. {
  630. userId: this.$store.state.user.name,
  631. serialNumber: 'PRHeader2001FamilyName',
  632. tableId: this.$route.meta.menuId + 'PR01',
  633. tableName: "PRHeader",
  634. columnProp: "familyName",
  635. headerAlign: "center",
  636. align: "center",
  637. columnLabel: "工具类型",
  638. columnHidden: false,
  639. columnImage: false,
  640. columnSortable: false,
  641. sortLv: 0,
  642. status: true,
  643. fixed: false
  644. },
  645. {
  646. userId: this.$store.state.user.name,
  647. serialNumber: 'PRHeader2001EnterDate',
  648. tableId: this.$route.meta.menuId + 'PR01',
  649. tableName: "PRHeader",
  650. columnProp: "enterDate",
  651. headerAlign: "center",
  652. align: "center",
  653. columnLabel: "创建时间",
  654. columnHidden: false,
  655. columnImage: false,
  656. columnSortable: false,
  657. sortLv: 0,
  658. status: true,
  659. fixed: false
  660. },
  661. {
  662. userId: this.$store.state.user.name,
  663. serialNumber: 'PRHeader2001AuthorizeFlag',
  664. tableId: this.$route.meta.menuId + 'PR01',
  665. tableName: "PRHeader",
  666. columnProp: "strAuthorizeFlag",
  667. headerAlign: "center",
  668. align: "center",
  669. columnLabel: "是否审批",
  670. columnHidden: false,
  671. columnImage: false,
  672. columnSortable: false,
  673. sortLv: 0,
  674. status: true,
  675. fixed: false
  676. },
  677. {
  678. userId: this.$store.state.user.name,
  679. serialNumber: 'review2101AuthorizeFlag',
  680. tableId: "review2101",
  681. tableName: "PRHeader",
  682. columnProp: "approveresult",
  683. headerAlign: "center",
  684. align: "left",
  685. columnLabel: "审批结果",
  686. columnHidden: false,
  687. columnImage: false,
  688. columnSortable: false,
  689. sortLv: 0,
  690. status: true,
  691. fixed: false
  692. },
  693. ],
  694. // 展示列集
  695. columnList1: [
  696. {
  697. userId: this.$store.state.user.name,
  698. tableId: this.$route.meta.menuId + 'PR02',
  699. tableName: "reviewDetails",
  700. columnProp: "stepId",
  701. headerAlign: "center",
  702. align: "center",
  703. columnLabel: "审批步骤号",
  704. columnHidden: false,
  705. columnImage: false,
  706. columnSortable: false,
  707. sortLv: 0,
  708. status: true,
  709. fixed: '',
  710. },
  711. {
  712. userId: this.$store.state.user.name,
  713. tableId: this.$route.meta.menuId + 'PR02',
  714. tableName: "reviewDetails",
  715. columnProp: "nameDesc",
  716. headerAlign: "center",
  717. align: "center",
  718. columnLabel: "审批类型/审批人",
  719. columnHidden: false,
  720. columnImage: false,
  721. columnSortable: false,
  722. sortLv: 0,
  723. status: true,
  724. fixed: false
  725. },
  726. {
  727. userId: this.$store.state.user.name,
  728. tableId: this.$route.meta.menuId + 'PR02',
  729. tableName: "reviewDetails",
  730. columnProp: "userName",
  731. headerAlign: "center",
  732. align: "center",
  733. columnLabel: "步骤审批人",
  734. columnHidden: false,
  735. columnImage: false,
  736. columnSortable: false,
  737. sortLv: 0,
  738. status: true,
  739. fixed: false
  740. },
  741. {
  742. userId: this.$store.state.user.name,
  743. tableId: this.$route.meta.menuId + 'PR02',
  744. tableName: "reviewDetails",
  745. columnProp: "actAuthorizeDate",
  746. headerAlign: "center",
  747. align: "center",
  748. columnLabel: "审批时间",
  749. columnHidden: false,
  750. columnImage: false,
  751. columnSortable: false,
  752. sortLv: 0,
  753. status: true,
  754. fixed: false
  755. },
  756. {
  757. userId: this.$store.state.user.name,
  758. tableId: this.$route.meta.menuId + 'PR02',
  759. tableName: "reviewDetails",
  760. columnProp: "approveResult",
  761. headerAlign: "center",
  762. align: "center",
  763. columnLabel: "审批结果",
  764. columnHidden: false,
  765. columnImage: false,
  766. columnSortable: false,
  767. sortLv: 0,
  768. status: true,
  769. fixed: '',
  770. },
  771. {
  772. userId: this.$store.state.user.name,
  773. tableId: this.$route.meta.menuId + 'PR02',
  774. tableName: "reviewDetails",
  775. columnProp: "remark",
  776. headerAlign: "center",
  777. align: "center",
  778. columnLabel: "审批备注",
  779. columnHidden: false,
  780. columnImage: false,
  781. columnSortable: false,
  782. sortLv: 0,
  783. status: true,
  784. fixed: '',
  785. },
  786. ],
  787. // 展示列集
  788. columnList2: [
  789. {
  790. userId: this.$store.state.user.name,
  791. tableId: this.$route.meta.menuId + 'PR03',
  792. tableName: "fileDetailTable",
  793. columnProp: "fileName",
  794. headerAlign: "center",
  795. align: "center",
  796. columnLabel: "文件名称",
  797. columnHidden: false,
  798. columnImage: false,
  799. columnSortable: false,
  800. sortLv: 0,
  801. status: true,
  802. fixed: false
  803. },
  804. {
  805. userId: this.$store.state.user.name,
  806. tableId: this.$route.meta.menuId + 'PR03',
  807. tableName: "fileDetailTable",
  808. columnProp: "createDate",
  809. headerAlign: "center",
  810. align: "center",
  811. columnLabel: "创建时间",
  812. columnHidden: false,
  813. columnImage: false,
  814. columnSortable: false,
  815. sortLv: 0,
  816. status: true,
  817. fixed: '',
  818. columnWidth: 135,
  819. },
  820. {
  821. userId: this.$store.state.user.name,
  822. tableId: this.$route.meta.menuId + 'PR03',
  823. tableName: "fileDetailTable",
  824. columnProp: "createdBy",
  825. headerAlign: "center",
  826. align: "center",
  827. columnLabel: "创建人",
  828. columnHidden: false,
  829. columnImage: false,
  830. columnSortable: false,
  831. sortLv: 0,
  832. status: true,
  833. fixed: '',
  834. columnWidth: 70,
  835. },
  836. ],
  837. // 数据集
  838. dataList: [],
  839. //选项
  840. orderTypeList: [],
  841. supplierList: [],
  842. queryButton: {
  843. table_id: this.$route.meta.menuId + 'PR01',
  844. languageCode: this.$i18n.locale,
  845. objectType: 'button'
  846. },
  847. buttons: {
  848. add: '添加',
  849. edit: '编辑',
  850. delete: '删除',
  851. deleteList: '批量删除',
  852. cz: '操作',
  853. search: '查询',
  854. download: '导出',
  855. settingTable: '设置列表',
  856. defaultTable: '设置默认配置',
  857. addLabelName: '新增',
  858. operating: '操作',
  859. reviewDetails: "审批详情",
  860. close: '关闭',
  861. fileDownload: '下载',
  862. reapply: '重新申请',
  863. preview: '预览',
  864. },
  865. // 导出 start
  866. exportData: [],
  867. exportDataStandard: {
  868. "功能编码": "functionId",
  869. "序列化编码": "objectId",
  870. "类型": "objectType",
  871. "语言值": "languageValue"
  872. },
  873. exportName: "刀申请",
  874. exportHeader: ["刀申请"],
  875. exportFooter: [],
  876. exportDefaultValue: "这一行这一列没有数据",
  877. // 导出 end
  878. buttonList: [
  879. // {
  880. // functionId: "9001",
  881. // languageValue: '添加',
  882. // objectId: 'add',
  883. // objectType: "button",
  884. // tableId: "common1001"
  885. // },
  886. // {
  887. // functionId: "9001",
  888. // languageValue: '编辑',
  889. // objectId: 'edit',
  890. // objectType: "button",
  891. // tableId: "common1001"
  892. // },
  893. // {
  894. // functionId: "9001",
  895. // languageValue: '删除',
  896. // objectId: 'delete',
  897. // objectType: "button",
  898. // tableId: "common1001"
  899. // },
  900. // {
  901. // functionId: "9001",
  902. // languageValue: '批量删除',
  903. // objectId: 'deleteList',
  904. // objectType: "button",
  905. // tableId: "common1001"
  906. // },
  907. // {
  908. // functionId: "9001",
  909. // languageValue: '操作',
  910. // objectId: 'cz',
  911. // objectType: "button",
  912. // tableId: "common1001"
  913. // },
  914. // {
  915. // functionId: "9001",
  916. // languageValue: '查询',
  917. // objectId: 'search',
  918. // objectType: "button",
  919. // tableId: "common1001"
  920. // },
  921. // {
  922. // functionId: "9001",
  923. // languageValue: '导出',
  924. // objectId: 'download',
  925. // objectType: "button",
  926. // tableId: "common1001"
  927. // },
  928. // {
  929. // functionId: "9001",
  930. // languageValue: '设置列表',
  931. // objectId: 'settingTable',
  932. // objectType: "button",
  933. // tableId: "common1001"
  934. // },
  935. // {
  936. // functionId: "9001",
  937. // languageValue: '设置默认配置',
  938. // objectId: 'defaultTable',
  939. // objectType: "button",
  940. // tableId: "common1001"
  941. // }
  942. ],
  943. languageList: [],
  944. languageColumnList: [],
  945. languageDataList: [],
  946. queryLanguage: {},
  947. // 数据集条件
  948. querySysLanguagePack: {
  949. page: 1,
  950. limit: 1,
  951. languageValue: '',
  952. objectType: '',
  953. objectId: ''
  954. },
  955. //
  956. // 分页
  957. pageIndex: 1,
  958. pageSize: 10,
  959. totalPage: 0,
  960. dataListLoading: false,
  961. dataListSelections: [],
  962. addOrUpdateVisible: false,
  963. showToolIdList: false
  964. }
  965. },
  966. watch: {
  967. currentPRDetailData: {
  968. deep: true,
  969. handler: function (newV, oldV) {
  970. this.currentPRDetailData.partno = this.currentPRDetailData.partno.toUpperCase()
  971. this.currentPRDetailData.partdesc = this.currentPRDetailData.partdesc.toUpperCase()
  972. this.currentPRDetailData.supplierid = this.currentPRDetailData.supplierid.toUpperCase()
  973. if (this.currentPRDetailData.addFlag == '1' || this.currentPRDetailData.addFlag == '') {
  974. this.showToolIdList = false
  975. } else {
  976. this.showToolIdList = true
  977. }
  978. }
  979. }
  980. },
  981. mounted() {
  982. this.$nextTick(() => {
  983. this.height = window.innerHeight - 210;
  984. })
  985. },
  986. activated() {
  987. this.getDataList()
  988. this.initTblBaseDataList()
  989. this.initSupplier()
  990. this.getPartFamily()
  991. this.getBusinessRoleList()
  992. },
  993. methods: {
  994. getBusinessRoleList() {
  995. let queryData = {
  996. active: 'Y'
  997. }
  998. getBusinessRoleList(queryData).then(({data}) => {
  999. if (data.code == 0) {
  1000. this.auditTypeList = data.rows
  1001. this.currentPRDetailData.orderType = data.rows[0].roleItemNo
  1002. }
  1003. })
  1004. },
  1005. delFile(row) {
  1006. console.log(row)
  1007. this.fileList = this.fileList.filter(item => item.id != row.id);
  1008. if (this.currentPRDetailData.requisitionno != '') {
  1009. let jsonData = {
  1010. sysOssId: row.id,
  1011. type: 'PRFile'
  1012. }
  1013. delFileAssociate(jsonData).then(({data}) => {
  1014. })
  1015. }
  1016. },
  1017. getBaseData(val) {
  1018. if (this.tagNo === 3) {
  1019. if (this.number == 1) {
  1020. this.mainQueryData.supplierid = val.SupplierID
  1021. } else {
  1022. this.currentPRDetailData.supplierid = val.SupplierID
  1023. this.currentPRDetailData.suppliername = val.SupplierName
  1024. }
  1025. }
  1026. if (this.tagNo === 70) {
  1027. this.currentPRDetailData.partno = val.ToolID
  1028. this.currentPRDetailData.partdesc = val.ToolDescription
  1029. }
  1030. },
  1031. // 获取基础数据列表
  1032. getBaseList(val, number) {
  1033. this.number = number
  1034. this.tagNo = val
  1035. this.$nextTick(() => {
  1036. let strVal = "";
  1037. if (val === 3) {
  1038. if (number == 1) {
  1039. strVal = this.mainQueryData.supplierid
  1040. } else {
  1041. strVal = this.currentPRDetailData.supplierid
  1042. }
  1043. }
  1044. if (val === 70) {
  1045. strVal = this.currentPRDetailData.partno
  1046. }
  1047. this.$refs.baseList.init(val, strVal)
  1048. })
  1049. },
  1050. getPartFamily() {
  1051. let jsonData = {
  1052. site: this.site,
  1053. active: 'Y',
  1054. }
  1055. this.selectList.select1 = []
  1056. getPartFamilyList(jsonData).then(({data}) => {
  1057. if (data.success) {
  1058. this.selectList.select1 = data.rows
  1059. }
  1060. })
  1061. },
  1062. //获取申请单号文件信息
  1063. getFileList(row) {
  1064. let jsonData = {
  1065. site: row.site,
  1066. type: 'PRFile',
  1067. associatedField1: row.requisitionno
  1068. }
  1069. this.fileList = []
  1070. getFileList(jsonData).then(({data}) => {
  1071. if (data.code == 0) {
  1072. this.fileList = data.row
  1073. }
  1074. })
  1075. },
  1076. // 文件下载
  1077. fileDownload(row) {
  1078. axios.get('/api/ftp/file/downFtpFile/' + row.id, {
  1079. responseType: 'blob',
  1080. headers: {
  1081. 'Content-Type': 'application/json',
  1082. 'token': Vue.cookie.get('token')
  1083. }
  1084. }).then(({data}) => {
  1085. // 不限制文件下载类型
  1086. const blob = new Blob([data], {type: "application/octet-stream"})
  1087. // 下载文件名称
  1088. const fileName = row.fileName
  1089. // a标签下载
  1090. const linkNode = document.createElement('a')
  1091. linkNode.download = fileName // a标签的download属性规定下载文件的名称
  1092. linkNode.style.display = 'none'
  1093. linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
  1094. // if(val == 'Y'){
  1095. // this.pdfVisible = true
  1096. // this.pdfUrl = linkNode.href
  1097. // }else {
  1098. document.body.appendChild(linkNode)
  1099. linkNode.click() // 模拟在按钮上的一次鼠标单击
  1100. URL.revokeObjectURL(linkNode.href) // 释放URL 对象
  1101. document.body.removeChild(linkNode)
  1102. // }
  1103. })
  1104. },
  1105. filePreview(row) {
  1106. this.pdfVisible = true
  1107. this.pdfUrl = '/file/' + row.newFileName
  1108. },
  1109. childByValue(childValue) {
  1110. // childValue就是子组件传过来的值
  1111. this.fileList.push(childValue)
  1112. this.insertFileList.push(childValue)
  1113. },
  1114. updateAuthorizeFlag(row) {
  1115. let saveData = {
  1116. site: row.site,
  1117. requisitionno: row.requisitionno,
  1118. status: '已关闭',
  1119. authorizeFlag: 'Y',
  1120. approvedFlag: 'N',
  1121. }
  1122. this.$confirm(`确实要关闭[${row.requisitionno}]申请单吗?`, '提示', {
  1123. confirmButtonText: '确认',
  1124. celButtonText: '取消',
  1125. type: 'warning'
  1126. }).then(() => {
  1127. updatePRHeaderAuthorizeFlag(saveData).then(({data}) => {
  1128. if (data.code == 0) {
  1129. this.$message.success(data.msg)
  1130. this.getDataList()
  1131. } else {
  1132. this.$message.warning(data.msg)
  1133. }
  1134. })
  1135. });
  1136. },
  1137. initReviewDetails(orderRef1) {
  1138. this.reviewDetailsFlag = true
  1139. this.reviewDetailsList = []
  1140. this.getAuthorizationHistList(orderRef1)
  1141. },
  1142. getAuthorizationHistList(orderRef1) {
  1143. let queryData = {
  1144. site: this.site,
  1145. orderRef1: orderRef1,
  1146. authRuleId: 5,
  1147. }
  1148. authorizationHistList(queryData).then(({data}) => {
  1149. this.reviewDetailsList = data.rows
  1150. })
  1151. },
  1152. getNumber() {
  1153. this.currentPRDetailData.totalPrice = this.decimalUtil.mul(this.currentPRDetailData.qty, this.currentPRDetailData.price)
  1154. },
  1155. savePRDetail() {
  1156. this.bannersBut = true
  1157. if (!this.currentPRDetailData.orderType) {
  1158. this.$alert('请选择处理类型!', '操作提示', {
  1159. confirmButtonText: '确定',
  1160. callback: action => {
  1161. this.bannersBut = false
  1162. }
  1163. });
  1164. return
  1165. } else if (this.currentPRDetailData.supplierid == null || this.currentPRDetailData.supplierid.trim() === "") {
  1166. this.$alert('请选择供应商名称!', '操作提示', {
  1167. confirmButtonText: '确定',
  1168. callback: action => {
  1169. this.bannersBut = false
  1170. }
  1171. });
  1172. return
  1173. } else if (this.currentPRDetailData.partno == null || this.currentPRDetailData.partno.trim() === "") {
  1174. this.$alert('请输入刀模编码!', '操作提示', {
  1175. confirmButtonText: '确定',
  1176. callback: action => {
  1177. this.bannersBut = false
  1178. }
  1179. });
  1180. return
  1181. } else if (this.currentPRDetailData.qty === 0 || this.currentPRDetailData.qty <= 0) {
  1182. this.$alert('请输入申请数量!', '操作提示', {
  1183. confirmButtonText: '确定',
  1184. callback: action => {
  1185. this.bannersBut = false
  1186. }
  1187. });
  1188. return
  1189. } else if (this.currentPRDetailData.price === 0 || this.currentPRDetailData.price <= 0) {
  1190. this.$alert('请输入预估单价!', '操作提示', {
  1191. confirmButtonText: '确定',
  1192. callback: action => {
  1193. this.bannersBut = false
  1194. }
  1195. });
  1196. return
  1197. } else if (this.currentPRDetailData.partDesc === 0 || this.currentPRDetailData.partDesc <= 0) {
  1198. this.$alert('请输入刀模名称!', '操作提示', {
  1199. confirmButtonText: '确定',
  1200. callback: action => {
  1201. this.bannersBut = false
  1202. }
  1203. });
  1204. return
  1205. } else if (this.currentPRDetailData.orderref1.trim() === "") {
  1206. this.$alert('请输入工具类型!', '操作提示', {
  1207. confirmButtonText: '确定',
  1208. callback: action => {
  1209. this.bannersBut = false
  1210. }
  1211. });
  1212. return
  1213. }
  1214. if (this.addFlagShow) {
  1215. if (this.currentPRDetailData.addFlag == '') {
  1216. this.$message.warning("请选择是否新增")
  1217. this.bannersBut = false
  1218. return
  1219. }
  1220. } else {
  1221. if (this.currentPRDetailData.partdesc == '') {
  1222. this.$message.warning("请输入工名称")
  1223. this.bannersBut = false
  1224. return
  1225. }
  1226. }
  1227. let partNo = this.currentPRDetailData.partno.toUpperCase()
  1228. this.currentPRDetailData.partno = partNo
  1229. // let filter = this.supplierList.filter(item => item.supplierid === this.currentPRDetailData.supplierid);
  1230. // this.currentPRDetailData.suppliername = filter[0].suppliername
  1231. this.currentPRDetailData.currency = ""
  1232. this.currentPRDetailData.taxcode = ""
  1233. this.currentPRDetailData.fileType = 'PRFile'
  1234. this.currentPRDetailData.sysOssEntityList = this.insertFileList
  1235. savePRDetail(this.currentPRDetailData).then(({data}) => {
  1236. this.bannersBut = false
  1237. if (data.code == 0) {
  1238. this.bannersFlag = false
  1239. this.getDataList()
  1240. this.$message.success(data.msg)
  1241. this.addPRDetailFlag = false
  1242. } else {
  1243. this.$message.warning(data.msg)
  1244. }
  1245. this.bannersBut = false
  1246. })
  1247. },
  1248. initSupplier() {
  1249. let queryData = {
  1250. site: this.site
  1251. }
  1252. getSupplierList(queryData).then(({data}) => {
  1253. this.supplierList = data.rows
  1254. })
  1255. },
  1256. initTblBaseDataList() {
  1257. let queryData = {
  1258. type: 'orderType'
  1259. }
  1260. getTblBaseDataList(queryData).then(({data}) => {
  1261. this.orderTypeList = data.rows
  1262. })
  1263. },
  1264. initReapply(row) {
  1265. this.currentPRDetailData.orderref1 = row.requisitionno
  1266. this.currentPRDetailData.orderref2 = row.itemno
  1267. this.initAddModel(null, 'Y')
  1268. },
  1269. initAddModel(row, val) {
  1270. this.initTblBaseDataList()
  1271. this.getBusinessRoleList()
  1272. this.getPartFamily()
  1273. this.fileList = []
  1274. this.insertFileList = []
  1275. if (row == null) {
  1276. this.currentPRDetailData.requisitionno = ''
  1277. this.currentPRDetailData.itemno = ''
  1278. this.currentPRDetailData.supplierid = ''
  1279. this.currentPRDetailData.suppliername = ''
  1280. this.currentPRDetailData.orderType = ''
  1281. this.currentPRDetailData.partno = ''
  1282. this.currentPRDetailData.qty = 0
  1283. this.currentPRDetailData.price = 0
  1284. this.currentPRDetailData.status = '已下达'
  1285. this.currentPRDetailData.taxCode = ''
  1286. this.currentPRDetailData.partdesc = ''
  1287. this.currentPRDetailData.orderref1 = ''
  1288. this.currentPRDetailData.addFlag = ''
  1289. this.currentPRDetailData.lifespan = ''
  1290. this.currentPRDetailData.remark = ''
  1291. this.currentPRDetailData.toolInstanceId = ''
  1292. this.addFlagShow = true
  1293. } else {
  1294. this.addFlagShow = false
  1295. this.currentPRDetailData.requisitionno = row.requisitionno
  1296. this.currentPRDetailData.itemno = row.itemno
  1297. this.currentPRDetailData.supplierid = row.supplierid
  1298. this.currentPRDetailData.suppliername = row.suppliername
  1299. this.currentPRDetailData.orderType = Number(row.orderType)
  1300. this.currentPRDetailData.partno = row.partno
  1301. this.currentPRDetailData.qty = row.qty
  1302. this.currentPRDetailData.price = row.price
  1303. this.currentPRDetailData.status = ''
  1304. this.currentPRDetailData.taxCode = row.taxCode
  1305. this.currentPRDetailData.partDesc = row.partdesc
  1306. this.currentPRDetailData.orderref1 = row.orderref1
  1307. this.currentPRDetailData.lifespan = row.lifespan
  1308. this.currentPRDetailData.remark = row.remark
  1309. this.currentPRDetailData.toolInstanceId = row.toolInstanceId
  1310. this.getFileList(row)
  1311. }
  1312. /* if (val != 'Y') {
  1313. this.currentPRDetailData.orderref1 = null
  1314. this.currentPRDetailData.orderref2 = null
  1315. }*/
  1316. this.getNumber()
  1317. this.bannersBut = false
  1318. this.addPRDetailFlag = true
  1319. },
  1320. // 校验用户是否收藏
  1321. favoriteIsOk() {
  1322. let userFavorite = {
  1323. userId: this.$store.state.user.id,
  1324. languageCode: this.$i18n.locale
  1325. }
  1326. userFavoriteList(userFavorite).then(({data}) => {
  1327. let size = data.list.filter(item => item.userId == userFavorite.menuId).length;
  1328. if (size > 0) {
  1329. this.favorite = true
  1330. } else {
  1331. this.favorite = false
  1332. }
  1333. })
  1334. },
  1335. // 收藏 OR 取消收藏
  1336. favoriteFunction() {
  1337. let userFavorite = {
  1338. userId: this.$store.state.user.id,
  1339. functionId: this.$route.meta.menuId,
  1340. }
  1341. if (this.favorite) {
  1342. // 取消收藏
  1343. this.$confirm(`确定取消收藏`, '提示', {
  1344. confirmButtonText: '确定',
  1345. cancelButtonText: '取消',
  1346. type: 'warning'
  1347. }).then(() => {
  1348. removeUserFavorite(userFavorite).then(({data}) => {
  1349. this.$message.success(data.msg)
  1350. this.favorite = false
  1351. })
  1352. })
  1353. } else {
  1354. // 收藏
  1355. saveUserFavorite(userFavorite).then(({data}) => {
  1356. this.$message.success(data.msg)
  1357. this.favorite = true
  1358. })
  1359. }
  1360. },
  1361. // 获取button的词典
  1362. getFunctionButtonList() {
  1363. searchFunctionButtonList(this.queryButton).then(({data}) => {
  1364. if (data.data.length > 0) {
  1365. this.buttons = data.data
  1366. } else {
  1367. saveButtonList(this.buttonList).then(({data}) => {
  1368. })
  1369. }
  1370. })
  1371. },
  1372. // 获取语言词典
  1373. getSysLanguageParamList() {
  1374. searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
  1375. this.sysLanguageParams = data.rows
  1376. })
  1377. },
  1378. // 打开页面设置
  1379. userSetting() {
  1380. this.visible = true;
  1381. let queryTable = {
  1382. userId: this.userId,
  1383. functionId: this.functionId,
  1384. tableId: this.tableId,
  1385. languageCode: this.$i18n.locale
  1386. }
  1387. this.$nextTick(() => {
  1388. this.$refs.column.init(queryTable);
  1389. });
  1390. },
  1391. // 获取 用户的配置
  1392. getTableUserAll() {
  1393. let queryTable = {
  1394. userId: this.$store.state.user.name,
  1395. tableId: "common1001",
  1396. languageCode: this.$i18n.locale
  1397. }
  1398. getTableUserListLanguage(queryTable).then(({data}) => {
  1399. if (data.code == 0) {
  1400. this.userColumnList = data.rows
  1401. if (data.rows.length <= 0) {
  1402. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  1403. this.userColumnList = data.rows
  1404. })
  1405. }
  1406. }
  1407. })
  1408. },
  1409. // 修改 table 列
  1410. updateColumnList() {
  1411. let userColumns = []
  1412. for (let column of this.userColumnList) {
  1413. let userColumn = {
  1414. userId: this.$store.state.user.name,
  1415. functionId: column.functionId,
  1416. tableId: column.tableId,
  1417. tableName: column.tableName,
  1418. columnProp: column.columnProp,
  1419. headerAlign: column.headerAlign,
  1420. align: column.align,
  1421. columnWidth: column.columnWidth,
  1422. columnLabel: column.columnLabel,
  1423. columnHidden: column.columnHidden,
  1424. columnImage: column.columnImage,
  1425. columnSortable: column.columnSortable,
  1426. format: column.format,
  1427. sortLv: column.sortLv,
  1428. status: column.status,
  1429. fixed: column.fixed,
  1430. serialNumber: column.serialNumber
  1431. }
  1432. userColumns.push(userColumn)
  1433. }
  1434. saveTableUser(userColumns).then(({data}) => {
  1435. if (data.code == 0) {
  1436. this.$message.success(data.msg)
  1437. this.visible = false
  1438. this.getTableUserColumn()
  1439. } else {
  1440. this.$message.error(data.msg)
  1441. }
  1442. })
  1443. },
  1444. // 获取 用户保存的 格式列
  1445. getTableUserColumn() {
  1446. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  1447. if (data.rows.length > 0) {
  1448. //this.columnList = []
  1449. this.columnList = data.rows
  1450. } else {
  1451. this.getColumnList()
  1452. }
  1453. })
  1454. },
  1455. // 保存 默认配置 列
  1456. async saveColumnList() {
  1457. // 删除所有的该页面下保存的数据
  1458. if (this.userColumnList) {
  1459. //删除 user自定义的数据
  1460. await removerUser(this.queryTable)
  1461. }
  1462. // 删除默认配置
  1463. await removerDefault(this.queryTable)
  1464. // 保存页面 table属性
  1465. let sumColumnList = this.columnList.concat(this.columnList1);
  1466. sumColumnList = sumColumnList.map(item => {
  1467. return item = {
  1468. tableId: item.tableId,
  1469. tableName: item.tableName,
  1470. columnProp: item.columnProp,
  1471. columnLabel: item.columnLabel,
  1472. columnHidden: false,
  1473. columnImage: false,
  1474. columnSortable: item.columnSortable,
  1475. columnWidth: item.columnWidth,
  1476. format: item.format,
  1477. functionId: this.$route.meta.menuId,
  1478. sortLv: item.sortLv,
  1479. status: true,
  1480. fixed: item.fixed,
  1481. serialNumber: item.serialNumber,
  1482. columnType: item.columnType,
  1483. align: item.align
  1484. }
  1485. })
  1486. await saveTableDefaultList(sumColumnList)
  1487. // 保存页面 button label title 属性
  1488. let buttons = this.buttonList.map(item => {
  1489. return item = {
  1490. functionId: this.$route.meta.menuId,
  1491. languageValue: item.languageValue,
  1492. objectId: item.objectId,
  1493. objectType: item.objectType,
  1494. tableId: item.tableId
  1495. }
  1496. })
  1497. await saveButtonList(buttons)
  1498. this.getFunctionButtonList()
  1499. this.getColumnList()
  1500. },
  1501. // 获取 tableDefault 列
  1502. getColumnList() {
  1503. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  1504. if (!data.rows.length == 0) {
  1505. // this.showDefault = false
  1506. this.columnList = data.rows
  1507. } else {
  1508. // this.showDefault = true
  1509. }
  1510. })
  1511. },
  1512. // 获取数据列表
  1513. getDataList(val) {
  1514. this.dataListLoading = true
  1515. if (val == 'Y') {
  1516. this.pageIndex = 1
  1517. }
  1518. this.mainQueryData.limit = this.pageSize
  1519. this.mainQueryData.page = this.pageIndex
  1520. getPRHeaderList(this.mainQueryData).then(({data}) => {
  1521. if (data && data.code === 0) {
  1522. this.dataList = data.rows.list
  1523. this.totalPage = data.rows.totalCount
  1524. } else {
  1525. this.dataList = []
  1526. this.totalPage = 0
  1527. }
  1528. this.dataListLoading = false
  1529. })
  1530. },
  1531. // 每页数
  1532. sizeChangeHandle(val) {
  1533. this.pageSize = val
  1534. this.pageIndex = 1
  1535. this.getDataList()
  1536. },
  1537. // 当前页
  1538. currentChangeHandle(val) {
  1539. this.pageIndex = val
  1540. this.getDataList()
  1541. },
  1542. // 多选
  1543. selectionChangeHandle(val) {
  1544. this.dataListSelections = val
  1545. },
  1546. createExportData() {
  1547. // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据
  1548. // TODO:构造需要下载的数据返回
  1549. getExportList(this.mainQueryData).then(({data}) => {
  1550. if (data && data.code === 0) {
  1551. return data.rows.list
  1552. }
  1553. return this.dataList;
  1554. })
  1555. },
  1556. startDownload() {
  1557. // this.exportData = this.dataList
  1558. console.log("数据开始")
  1559. },
  1560. finishDownload() {
  1561. console.log("数据下载完成")
  1562. },
  1563. fields() {
  1564. let json = "{"
  1565. this.columnList.forEach((item, index) => {
  1566. if (index == this.columnList.length - 1) {
  1567. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1568. } else {
  1569. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1570. }
  1571. })
  1572. json += "}"
  1573. let s = eval("(" + json + ")")
  1574. return s
  1575. },
  1576. },
  1577. created() {
  1578. this.getTableUserColumn()
  1579. this.getSysLanguageParamList()
  1580. this.getFunctionButtonList()
  1581. this.favoriteIsOk()
  1582. }
  1583. }
  1584. </script>
  1585. <style scoped lang="scss">
  1586. .sl-svg {
  1587. overflow: hidden;
  1588. float: right;
  1589. }
  1590. /*统一的input内容颜色样式*/
  1591. .customer-input-color-red /deep/ .el-input__inner {
  1592. color: red;
  1593. }
  1594. </style>