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.

808 lines
29 KiB

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