plm前端
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.

831 lines
28 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 工具申请界面-->
  4. <el-form label-position="top" :model="searchData">
  5. <el-row :gutter="18">
  6. <el-col :span="2">
  7. <el-form-item label="项目编号">
  8. <el-input v-model="searchData.projectId" clearable />
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="2">
  12. <el-form-item label="项目类型">
  13. <dict-data-select dict-type="project_info_type_db" filterable clearable :use-default-value="false" v-model="searchData.projectType"></dict-data-select>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="2">
  17. <el-form-item label="项目责任人">
  18. <el-input v-model="searchData.projectOwnerName" clearable/>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="4">
  22. <el-form-item label="项目名称">
  23. <el-input v-model="searchData.projectName" clearable/>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="4">
  27. <el-form-item label=" ">
  28. <el-button plain type="primary" @click="initDataBtn" > </el-button>
  29. <el-button type="primary" @click="applyModel">刀模申请</el-button>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. </el-form>
  34. <el-table
  35. :data="dataList"
  36. :height="height"
  37. border
  38. @selection-change="selectionChangeHandle"
  39. v-loading="dataListLoading"
  40. style="width: 100%; ">
  41. <el-table-column
  42. type="selection"
  43. align="center"
  44. width="30">
  45. </el-table-column>
  46. <el-table-column
  47. v-for="(item,index) in columnList1" :key="index"
  48. :sortable="item.columnSortable"
  49. :prop="item.columnProp"
  50. :header-align="item.headerAlign"
  51. :show-overflow-tooltip="item.showOverflowTooltip"
  52. :align="item.align"
  53. :fixed="item.fixed==''?false:item.fixed"
  54. :min-width="item.columnWidth"
  55. :label="item.columnLabel">
  56. <template slot-scope="scope">
  57. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  58. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  59. style="width: 100px; height: 80px"/></span>
  60. </template>
  61. </el-table-column>
  62. <!-- <el-table-column-->
  63. <!-- header-align="center"-->
  64. <!-- align="center"-->
  65. <!-- width="150"-->
  66. <!-- fixed="right"-->
  67. <!-- label="操作">-->
  68. <!-- <template slot-scope="scope">-->
  69. <!-- <a type="text" size="small" @click="updateModel(scope.row)">修改</a>-->
  70. <!-- <a type="text" size="small" @click="deleteData(scope.row)">删除</a>-->
  71. <!-- </template>-->
  72. <!-- </el-table-column>-->
  73. </el-table>
  74. <el-pagination
  75. @size-change="sizeChangeHandle"
  76. @current-change="currentChangeHandle"
  77. :current-page="pageIndex"
  78. :page-sizes="[20, 50, 100, 1000]"
  79. :page-size="pageSize"
  80. :total="totalPage"
  81. layout="total, sizes, prev, pager, next, jumper">
  82. </el-pagination>
  83. <el-dialog
  84. width="800px" v-drag
  85. :title="'刀模申请'"
  86. :close-on-click-modal="false"
  87. :visible.sync="visible">
  88. <el-form :inline="true" label-position="top" label-width="100px" >
  89. <el-form-item :label="'申请编号'">
  90. <el-input v-model="dataForm.applyNo" style="width: 130px" disabled></el-input>
  91. </el-form-item>
  92. <el-form-item :label="'申请总数'">
  93. <el-input v-model="dataForm.applySumQty" style="width: 130px" disabled></el-input>
  94. </el-form-item>
  95. <!-- <el-form-item :label="'总金额'">-->
  96. <!-- <el-input v-model="dataForm.allCost" style="width: 130px" disabled></el-input>-->
  97. <!-- </el-form-item>-->
  98. <el-form-item label="部门" required="required">
  99. <dict-data-select :site="$store.state.user.site" v-model="dataForm.department" dict-type="tool_application_department" style="width: 130px"></dict-data-select>
  100. </el-form-item>
  101. <el-form-item :label="'申请人'" required="required">
  102. <el-input v-model="dataForm.applyBy" style="width: 130px" ></el-input>
  103. </el-form-item>
  104. <el-form-item :label="'申请日期'" required="required">
  105. <el-date-picker
  106. value-format="yyyy-MM-dd"
  107. style="width: 100%"
  108. v-model="dataForm.applyDate"
  109. type="date"
  110. placeholder="结束日期">
  111. </el-date-picker>
  112. </el-form-item>
  113. <el-form-item required="required">
  114. <span slot="label" style="" @click="getBaseList(103,1)"><a herf="#">报价员</a></span>
  115. <el-input v-model="dataForm.quoterName" ref="quoterName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
  116. </el-form-item>
  117. <el-form-item required="required">
  118. <span slot="label" style="" @click="getBaseList(103,2)"><a herf="#">TP</a></span>
  119. <el-input v-model="dataForm.tpName" ref="tpName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
  120. </el-form-item>
  121. <el-form-item required="required">
  122. <span slot="label" style="" @click="getBaseList(103,3)"><a herf="#">采购员</a></span>
  123. <el-input v-model="dataForm.purchaserName" ref="purchaserName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
  124. </el-form-item>
  125. </el-form>
  126. <el-form :inline="true" label-position="top" label-width="100px" >
  127. <el-form-item :label="'申请原因'">
  128. <!-- <el-input v-model="dataForm.applyReason" style="width: 770px" ></el-input>-->
  129. <el-input type="textarea" style="width: 770px" resize="none" :autosize="{minRows: 3, maxRows: 3}"
  130. v-model="dataForm.applyReason"/>
  131. </el-form-item>
  132. </el-form>
  133. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 60px">
  134. <el-form-item :label="'备注'">
  135. <!-- <el-input v-model="dataForm.remark" style="width: 770px" ></el-input>-->
  136. <el-input type="textarea" style="width: 770px" resize="none" :autosize="{minRows: 3, maxRows: 3}"
  137. v-model="dataForm.remark"/>
  138. </el-form-item>
  139. </el-form>
  140. <div class="rq" style="margin-top: 60px">
  141. <el-table
  142. height="250"
  143. :data="toolData"
  144. border
  145. ref="toolTable"
  146. v-loading="dataListLoading"
  147. style="width: 100%;">
  148. <el-table-column label="项目号" width="90" prop="projectId" show-overflow-tooltip/>
  149. <el-table-column label="物料编码" width="100" prop="partNo" show-overflow-tooltip/>
  150. <el-table-column label="工具描述" width="120" prop="toolDescription" show-overflow-tooltip/>
  151. <el-table-column label="工具数量" width="60" prop="toolQty" show-overflow-tooltip/>
  152. <el-table-column label="申请数量" width="70" prop="applyQty" show-overflow-tooltip>
  153. <template slot-scope="scope">
  154. <el-input v-model="scope.row.applyQty" type="number" @change="changeSum(scope.row)" placeholder="请输入数量" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
  155. style="width:98%"></el-input>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="物料名称" width="160" prop="partDesc" show-overflow-tooltip/>
  159. <el-table-column label="工艺版本" width="80" prop="routingRevision" show-overflow-tooltip/>
  160. <el-table-column label="工艺类型" width="80" prop="routingType" show-overflow-tooltip/>
  161. <el-table-column label="替代编码" width="80" prop="alternativeNo" show-overflow-tooltip/>
  162. <el-table-column label="替代名称" width="80" prop="alternativeDescription" show-overflow-tooltip/>
  163. <el-table-column label="工序号" width="60" prop="operationNo" show-overflow-tooltip/>
  164. <el-table-column label="工序名称" width="80" prop="operationName" show-overflow-tooltip/>
  165. <el-table-column label="工具成本" width="60" prop="standardCost" show-overflow-tooltip/>
  166. <!-- <el-table-column label="单位报价成本" width="90" prop="quotationUnitCost" show-overflow-tooltip/>-->
  167. <!-- <el-table-column label="预计使用寿命" width="90" prop="expectedServiceLife" show-overflow-tooltip/>-->
  168. </el-table>
  169. </div>
  170. <span slot="footer" class="dialog-footer">
  171. <el-button type="primary" @click="saveData()">{{'保存'}}</el-button>
  172. <el-button type="primary" @click="visible = false">{{'取消'}}</el-button>
  173. </span>
  174. </el-dialog>
  175. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  176. <ChooseUser ref="userList" @getBaseData="getUserData"></ChooseUser>
  177. </div>
  178. </template>
  179. <script>
  180. import {projectInfoForToolApply,
  181. getProjectPartToolForApply,
  182. saveProjectToolApply,
  183. } from "@/api/tool/toolApply.js"
  184. import Chooselist from '@/views/modules/common/Chooselist'
  185. import DictDataSelect from "../sys/dict-data-select.vue"
  186. import ChooseUser from '@/views/modules/common/ChooseUser'
  187. export default {
  188. components: {
  189. Chooselist, DictDataSelect,ChooseUser,
  190. },
  191. data() {
  192. return {
  193. height: 200,
  194. dataList: [],
  195. searchFlag:false,
  196. // 搜索条件对象
  197. searchData:{
  198. page: 1,
  199. limit: 100,
  200. site:this.$store.state.user.site,
  201. projectId:'',
  202. projectType:'',
  203. projectOwnerName:'',
  204. projectName:'',
  205. userName:this.$store.state.user.name,
  206. },
  207. exportList:[],
  208. pageIndex: 1,
  209. pageSize: 100,
  210. totalPage: 0,
  211. visible:false,
  212. dataListLoading: false,
  213. currentRow:'',
  214. columnList1: [
  215. {
  216. userId: this.$store.state.user.name,
  217. functionId: 106001001,
  218. serialNumber: '106001001Table1ProjectId',
  219. tableId: "106001001Table1",
  220. tableName: "项目信息主表",
  221. columnProp: "projectId",
  222. headerAlign: "center",
  223. align: "center",
  224. columnLabel: "项目号",
  225. columnHidden: false,
  226. columnImage: false,
  227. columnSortable: false,
  228. sortLv: 0,
  229. status: true,
  230. fixed: '',
  231. columnWidth: 100
  232. },
  233. {
  234. userId: this.$store.state.user.name,
  235. functionId: 106001001,
  236. serialNumber: '106001001Table1ProjectType',
  237. tableId: "106001001Table1",
  238. tableName: "项目信息主表",
  239. columnProp: "projectType",
  240. headerAlign: "center",
  241. align: "left",
  242. columnLabel: "项目类型",
  243. columnHidden: false,
  244. columnImage: false,
  245. columnSortable: false,
  246. sortLv: 0,
  247. status: true,
  248. fixed: '',
  249. columnWidth: 100
  250. },
  251. {
  252. userId: this.$store.state.user.name,
  253. functionId: 106001001,
  254. serialNumber: '106001001Table1ProjectName',
  255. tableId: "106001001Table1",
  256. tableName: "项目信息主表",
  257. columnProp: "projectName",
  258. headerAlign: "center",
  259. align: "left",
  260. columnLabel: "项目名称",
  261. columnHidden: false,
  262. columnImage: false,
  263. columnSortable: false,
  264. sortLv: 0,
  265. status: true,
  266. fixed: '',
  267. columnWidth: 200
  268. },
  269. {
  270. userId: this.$store.state.user.name,
  271. functionId: 106001001,
  272. serialNumber: '106001001Table1Status',
  273. tableId: "106001001Table1",
  274. tableName: "项目信息主表",
  275. columnProp: "status",
  276. headerAlign: "center",
  277. align: "left",
  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: 106001001,
  290. serialNumber: '106001001Table1Priority',
  291. tableId: "106001001Table1",
  292. tableName: "项目信息主表",
  293. columnProp: "priorityDesc",
  294. headerAlign: "center",
  295. align: "left",
  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: 106001001,
  308. // serialNumber: '106001001Table1BuNo',
  309. // tableId: "106001001Table1",
  310. // tableName: "项目信息主表",
  311. // columnProp: "buNo",
  312. // headerAlign: "center",
  313. // align: "left",
  314. // columnLabel: "BU编码",
  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: 106001001,
  326. // serialNumber: '106001001Table1BuDesc',
  327. // tableId: "106001001Table1",
  328. // tableName: "项目信息主表",
  329. // columnProp: "buDesc",
  330. // headerAlign: "center",
  331. // align: "left",
  332. // columnLabel: "BU名称",
  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: 106001001,
  344. serialNumber: '106001001Table1ProjectOwnerName',
  345. tableId: "106001001Table1",
  346. tableName: "项目信息主表",
  347. columnProp: "projectOwnerName",
  348. headerAlign: "center",
  349. align: "left",
  350. columnLabel: "项目负责人",
  351. columnHidden: false,
  352. columnImage: false,
  353. columnSortable: false,
  354. sortLv: 0,
  355. status: true,
  356. fixed: '',
  357. columnWidth: 100
  358. },
  359. {
  360. userId: this.$store.state.user.name,
  361. functionId: 106001001,
  362. serialNumber: '106001001Table1ProjectSource',
  363. tableId: "106001001Table1",
  364. tableName: "项目信息主表",
  365. columnProp: "projectSourceDesc",
  366. headerAlign: "center",
  367. align: "left",
  368. columnLabel: "项目来源",
  369. columnHidden: false,
  370. columnImage: false,
  371. columnSortable: false,
  372. sortLv: 0,
  373. status: true,
  374. fixed: '',
  375. columnWidth: 100
  376. },
  377. {
  378. userId: this.$store.state.user.name,
  379. functionId: 106001001,
  380. serialNumber: '106001001Table1CustomerId',
  381. tableId: "106001001Table1",
  382. tableName: "项目信息主表",
  383. columnProp: "customerId",
  384. headerAlign: "center",
  385. align: "left",
  386. columnLabel: "客户代码",
  387. columnHidden: false,
  388. columnImage: false,
  389. columnSortable: false,
  390. sortLv: 0,
  391. status: true,
  392. fixed: '',
  393. columnWidth: 100
  394. },
  395. {
  396. userId: this.$store.state.user.name,
  397. functionId: 106001001,
  398. serialNumber: '106001001Table1CustomerName',
  399. tableId: "106001001Table1",
  400. tableName: "项目信息主表",
  401. columnProp: "customerName",
  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: 150
  412. },
  413. {
  414. userId: this.$store.state.user.name,
  415. functionId: 106001001,
  416. serialNumber: '106001001Table1CreateDate',
  417. tableId: "106001001Table1",
  418. tableName: "项目信息主表",
  419. columnProp: "createDate",
  420. headerAlign: "center",
  421. align: "left",
  422. columnLabel: "创建时间",
  423. columnHidden: false,
  424. columnImage: false,
  425. columnSortable: false,
  426. sortLv: 0,
  427. status: true,
  428. fixed: '',
  429. columnWidth: 120
  430. },
  431. {
  432. userId: this.$store.state.user.name,
  433. functionId: 106001001,
  434. serialNumber: '106001001Table1CreateBy',
  435. tableId: "106001001Table1",
  436. tableName: "项目信息主表",
  437. columnProp: "createBy",
  438. headerAlign: "center",
  439. align: "left",
  440. columnLabel: "创建人",
  441. columnHidden: false,
  442. columnImage: false,
  443. columnSortable: false,
  444. sortLv: 0,
  445. status: true,
  446. fixed: '',
  447. columnWidth: 80
  448. },
  449. {
  450. userId: this.$store.state.user.name,
  451. functionId: 106001001,
  452. serialNumber: '106001001Table1UpdateDate',
  453. tableId: "106001001Table1",
  454. tableName: "项目信息主表",
  455. columnProp: "updateDate",
  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. columnWidth: 120
  466. },
  467. {
  468. userId: this.$store.state.user.name,
  469. functionId: 106001001,
  470. serialNumber: '106001001Table1UpdateBy',
  471. tableId: "106001001Table1",
  472. tableName: "项目信息主表",
  473. columnProp: "updateBy",
  474. headerAlign: "center",
  475. align: "left",
  476. columnLabel: "修改人",
  477. columnHidden: false,
  478. columnImage: false,
  479. columnSortable: false,
  480. sortLv: 0,
  481. status: true,
  482. fixed: '',
  483. columnWidth: 80
  484. },
  485. ],
  486. dataForm:{
  487. site: '',
  488. applyNo: '',
  489. applyBy:'',
  490. applyDate:'',
  491. applySumQty:'',
  492. applyReason:'',
  493. remark:'',
  494. createBy:'',
  495. department:'',
  496. quoter: '',
  497. quoterName: '',
  498. tp: '',
  499. tpName: '',
  500. purchaser: '',
  501. purchaserName: '',
  502. detailList:[],
  503. },
  504. toolData:[],
  505. dataListSelections:[],
  506. dataRole: {
  507. partTypeDesc: [
  508. {
  509. required: true,
  510. message: ' ',
  511. trigger: 'change'
  512. }
  513. ],
  514. partName: [
  515. {
  516. required: true,
  517. message: ' ',
  518. trigger: 'change'
  519. }
  520. ],
  521. },
  522. // 导出 start
  523. exportData: [],
  524. exportName: '项目物料'+this.dayjs().format('YYYYMMDDHHmmss'),
  525. exportHeader: ["项目物料"],
  526. exportFooter: [],
  527. // 导出 end
  528. }
  529. },
  530. mounted() {
  531. this.$nextTick(() => {
  532. this.height = window.innerHeight - 190;
  533. })
  534. },
  535. methods: {
  536. getUserList (type) {
  537. if(this.ifDisableFlag){
  538. return false
  539. }
  540. this.tagNo1 = type
  541. this.$nextTick(() => {
  542. let strVal = ''
  543. if(type==1) {
  544. strVal = this.dataForm.quoter
  545. }
  546. if(type==2) {
  547. strVal = this.dataForm.tp
  548. }
  549. if(type==3) {
  550. strVal = this.dataForm.purchaser
  551. }
  552. this.$refs.userList.init(this.searchData.site,'%%', strVal)
  553. })
  554. },
  555. /* 列表方法的回调 */
  556. getUserData (val) {
  557. if(this.tagNo1==1) {
  558. this.dataForm.quoter = val.username
  559. this.dataForm.quoterName = val.userDisplay
  560. this.$nextTick(() => {
  561. this.$triggerInputEvent(this.$refs.quoterName);
  562. });
  563. }
  564. if(this.tagNo1==2) {
  565. this.dataForm.tp = val.username
  566. this.dataForm.tpName = val.userDisplay
  567. this.$nextTick(() => {
  568. this.$triggerInputEvent(this.$refs.tpName);
  569. });
  570. }
  571. if(this.tagNo1==3) {
  572. this.dataForm.purchaser = val.username
  573. this.dataForm.purchaserName = val.userDisplay
  574. this.$nextTick(() => {
  575. this.$triggerInputEvent(this.$refs.purchaserName);
  576. });
  577. }
  578. },
  579. // 获取基础数据列表S
  580. getBaseList (val, type) {
  581. this.tagNo = val
  582. this.tagNo1 = type
  583. this.$nextTick(() => {
  584. let strVal = ''
  585. if (val === 103) {
  586. if(type==1) {
  587. strVal = this.dataForm.quoter
  588. }
  589. if(type==2) {
  590. strVal = this.dataForm.tp
  591. }
  592. if(type==3) {
  593. strVal = this.dataForm.purchaser
  594. }
  595. }
  596. this.$refs.baseList.init(val, strVal)
  597. })
  598. },
  599. /* 列表方法的回调 */
  600. getBaseData (val) {
  601. if (this.tagNo === 103) {
  602. if(this.tagNo1==1) {
  603. this.dataForm.quoter = val.username
  604. this.dataForm.quoterName = val.user_display
  605. this.$nextTick(() => {
  606. this.$triggerInputEvent(this.$refs.quoterName);
  607. });
  608. }
  609. if(this.tagNo1==2) {
  610. this.dataForm.tp = val.username
  611. this.dataForm.tpName = val.user_display
  612. this.$nextTick(() => {
  613. this.$triggerInputEvent(this.$refs.tpName);
  614. });
  615. }
  616. if(this.tagNo1==3) {
  617. this.dataForm.purchaser = val.username
  618. this.dataForm.purchaserName = val.user_display
  619. this.$nextTick(() => {
  620. this.$triggerInputEvent(this.$refs.purchaserName);
  621. });
  622. }
  623. }
  624. },
  625. selectionChangeHandle (val) {
  626. this.dataListSelections = val
  627. },
  628. // 每页数
  629. sizeChangeHandle (val) {
  630. this.pageSize = val
  631. this.pageIndex = 1
  632. this.search()
  633. },
  634. // 当前页
  635. currentChangeHandle (val) {
  636. this.pageIndex = val
  637. this.search()
  638. },
  639. initDataBtn(){
  640. this.initData();
  641. },
  642. // 初始化数据
  643. initData(){
  644. this.searchData.limit = this.pageSize
  645. this.searchData.page = this.pageIndex
  646. projectInfoForToolApply(this.searchData).then(({data}) => {
  647. if (data.code == 0) {
  648. this.dataList = data.page.list
  649. this.pageIndex = data.page.currPage
  650. this.pageSize = data.page.pageSize
  651. this.totalPage = data.page.totalCount
  652. }
  653. this.dataListLoading = false
  654. })
  655. },
  656. applyModel() {
  657. if(this.dataListSelections.length===0){
  658. this.$alert('请选择报价单!', '错误', {
  659. confirmButtonText: '确定'
  660. })
  661. return false;
  662. }
  663. getProjectPartToolForApply(this.dataListSelections).then(({data}) => {
  664. if (data.code == 0) {
  665. this.toolData=data.rows
  666. }
  667. })
  668. this.dataForm={
  669. site: this.$store.state.user.site,
  670. applyNo: '',
  671. applyBy:this.$store.state.user.name,
  672. applyDate:new Date(),
  673. applySumQty:0,
  674. applyReason:'',
  675. remark:'',
  676. createBy:this.$store.state.user.name,
  677. department: '',
  678. quoter: '',
  679. quoterName: '',
  680. tp: '',
  681. tpName: '',
  682. purchaser: '',
  683. purchaserName: '',
  684. detailList:[],
  685. };
  686. this.visible=true;
  687. },
  688. changeSum(row){
  689. // if(row.applyQty!=null&&row.applyQty!==''&& row.toolQuantity<row.applyQty){
  690. // row.applyQty=''
  691. // this.$alert(data.msg, '错误', {
  692. // confirmButtonText: '确定'
  693. // })
  694. //
  695. // }
  696. this.dataForm.applySumQty =0
  697. // this.dataForm.allCost =0
  698. for (const item of this.toolData) {
  699. // 累加之前先确保值存在,并将 null 或 undefined 转换为0
  700. this.dataForm.applySumQty += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty : 0);
  701. // this.dataForm.allCost += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty*item.standardCost : 0);
  702. }
  703. },
  704. saveData(){
  705. // for (let i = 0; i < this.toolData.length; i++) {
  706. // if(this.toolData[i].toolQuantity<this.toolData[i].applyQty){
  707. // this.$alert( '工具:'+this.toolData[i].toolNo +' 实际申请数量大于表单工具数量!', '错误', {
  708. // confirmButtonText: '确定'
  709. // })
  710. // return false;
  711. // }
  712. // }
  713. if(this.dataForm.applySumQty===0){
  714. this.$alert('未填写申请数量!', '错误', {
  715. confirmButtonText: '确定'
  716. })
  717. return false;
  718. }
  719. if(this.dataForm.applyBy===''||this.dataForm.applyBy==null){
  720. this.$alert('未选择申请人!', '错误', {
  721. confirmButtonText: '确定'
  722. })
  723. return false;
  724. }
  725. if(this.dataForm.applyDate===''||this.dataForm.applyDate==null){
  726. this.$alert('未选择申请日期!', '错误', {
  727. confirmButtonText: '确定'
  728. })
  729. return false;
  730. }
  731. if(this.dataForm.department===''||this.dataForm.department==null){
  732. this.$alert('未选择部门!', '错误', {
  733. confirmButtonText: '确定'
  734. })
  735. return false;
  736. }
  737. if(this.dataForm.quoter===''||this.dataForm.quoter==null){
  738. this.$alert('未选择报价员!', '错误', {
  739. confirmButtonText: '确定'
  740. })
  741. return false;
  742. }
  743. if(this.dataForm.tp===''||this.dataForm.tp==null){
  744. this.$alert('未选择TP!', '错误', {
  745. confirmButtonText: '确定'
  746. })
  747. return false;
  748. }
  749. if(this.dataForm.purchaser===''||this.dataForm.purchaser==null){
  750. this.$alert('未选择采购员!', '错误', {
  751. confirmButtonText: '确定'
  752. })
  753. return false;
  754. }
  755. this.$confirm('确定要保存?', '提示', {
  756. confirmButtonText: '确定',
  757. cancelButtonText: '取消',
  758. type: 'warning'
  759. }).then(() => {
  760. for (let i = 0; i < this.toolData.length; i++) {
  761. if (this.toolData[i].applyQty===''||this.toolData[i].applyQty==null){
  762. this.toolData[i].applyQty=0
  763. }
  764. }
  765. this.dataForm.detailList=this.toolData.filter(item => item.applyQty > 0)
  766. saveProjectToolApply(this.dataForm).then(({data}) => {
  767. if (data && data.code == 0) {
  768. this.visible=false;
  769. this.initDataBtn();
  770. this.$message({
  771. message: '操作成功',
  772. type: 'success',
  773. duration: 1500,
  774. onClose: () => {
  775. }
  776. })
  777. } else {
  778. this.$alert(data.msg, '错误', {
  779. confirmButtonText: '确定'
  780. })
  781. }
  782. })
  783. }).catch(() => {
  784. })
  785. },
  786. //导出excel
  787. //导出excel
  788. async createExportData() {
  789. // this.searchData.limit = -1
  790. // this.searchData.page = 1
  791. // await projectInfoSearch(this.searchData).then(({data}) => {
  792. // this.exportList= data.page.list;
  793. // })
  794. //
  795. // return this.exportList;
  796. },
  797. startDownload() {
  798. // this.exportData = this.dataList
  799. },
  800. finishDownload() {
  801. },
  802. fields() {
  803. let json = "{"
  804. this.columnList1.forEach((item, index) => {
  805. if (index == this.columnList1.length - 1) {
  806. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  807. } else {
  808. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  809. }
  810. })
  811. json += "}"
  812. let s = eval("(" + json + ")")
  813. return s
  814. },
  815. },
  816. }
  817. </script>
  818. <style scoped>
  819. </style>