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.

828 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
9 months ago
1 year ago
9 months ago
1 year ago
2 years ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
2 years ago
11 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. getUserList (type) {
  517. if(this.ifDisableFlag){
  518. return false
  519. }
  520. this.tagNo1 = type
  521. this.$nextTick(() => {
  522. let strVal = ''
  523. let conSql = " and b.site = '" + this.$store.state.user.site + "'";
  524. if(type==1) {
  525. strVal = this.dataForm.quoter
  526. }
  527. if(type==2) {
  528. strVal = this.dataForm.tp
  529. }
  530. if(type==3) {
  531. strVal = this.dataForm.purchaser
  532. }
  533. this.$refs.userList.init(this.searchData.site,'%%', strVal,conSql)
  534. })
  535. },
  536. /* 列表方法的回调 */
  537. getUserData (val) {
  538. if(this.tagNo1==1) {
  539. this.dataForm.quoter = val.username
  540. this.dataForm.quoterName = val.userDisplay
  541. this.$nextTick(() => {
  542. this.$triggerInputEvent(this.$refs.quoterName);
  543. });
  544. }
  545. if(this.tagNo1==2) {
  546. this.dataForm.tp = val.username
  547. this.dataForm.tpName = val.userDisplay
  548. this.$nextTick(() => {
  549. this.$triggerInputEvent(this.$refs.tpName);
  550. });
  551. }
  552. if(this.tagNo1==3) {
  553. this.dataForm.purchaser = val.username
  554. this.dataForm.purchaserName = val.userDisplay
  555. this.$nextTick(() => {
  556. this.$triggerInputEvent(this.$refs.purchaserName);
  557. });
  558. }
  559. },
  560. // 获取基础数据列表S
  561. getBaseList (val, type) {
  562. this.tagNo = val
  563. this.tagNo1 = type
  564. this.$nextTick(() => {
  565. let strVal = ''
  566. if(val==2002) {
  567. strVal = this.dataForm.quoter
  568. }
  569. if(val==2042) {
  570. strVal = this.dataForm.tp
  571. }
  572. if(val==2000) {
  573. strVal = this.dataForm.purchaser
  574. }
  575. this.$refs.baseList.init(val, strVal)
  576. })
  577. },
  578. /* 列表方法的回调 */
  579. getBaseData (val) {
  580. debugger;
  581. if(this.tagNo == 2002) {
  582. this.dataForm.quoter = val.username
  583. this.dataForm.quoterName = val.user_display
  584. this.$nextTick(() => {
  585. this.$triggerInputEvent(this.$refs.quoterName);
  586. });
  587. }
  588. if(this.tagNo == 2042) {
  589. this.dataForm.tp = val.username
  590. this.dataForm.tpName = val.user_display
  591. this.$nextTick(() => {
  592. this.$triggerInputEvent(this.$refs.tpName);
  593. });
  594. }
  595. if(this.tagNo ==2000) {
  596. this.dataForm.purchaser = val.username
  597. this.dataForm.purchaserName = val.user_display
  598. this.$nextTick(() => {
  599. this.$triggerInputEvent(this.$refs.purchaserName);
  600. });
  601. }
  602. },
  603. selectionChangeHandle (val) {
  604. this.dataListSelections = val
  605. },
  606. // 每页数
  607. sizeChangeHandle (val) {
  608. this.pageSize = val
  609. this.pageIndex = 1
  610. this.search()
  611. },
  612. // 当前页
  613. currentChangeHandle (val) {
  614. this.pageIndex = val
  615. this.search()
  616. },
  617. initDataBtn(){
  618. this.initData();
  619. },
  620. // 初始化数据
  621. initData(){
  622. this.searchData.limit = this.pageSize
  623. this.searchData.page = this.pageIndex
  624. projectInfoForToolApply(this.searchData).then(({data}) => {
  625. if (data.code == 0) {
  626. this.dataList = data.page.list
  627. this.pageIndex = data.page.currPage
  628. this.pageSize = data.page.pageSize
  629. this.totalPage = data.page.totalCount
  630. }
  631. this.dataListLoading = false
  632. })
  633. },
  634. applyModel() {
  635. if(this.dataListSelections.length===0){
  636. this.$alert('请选择项目!', '错误', {
  637. confirmButtonText: '确定'
  638. })
  639. return false;
  640. }
  641. getProjectPartToolForApply(this.dataListSelections).then(({data}) => {
  642. if (data.code == 0) {
  643. this.toolData=data.rows
  644. }
  645. })
  646. this.dataForm={
  647. site: this.$store.state.user.site,
  648. applyNo: '',
  649. applyBy:this.$store.state.user.name,
  650. applyDate:new Date(),
  651. applySumQty:0,
  652. applyReason:'',
  653. remark:'',
  654. createBy:this.$store.state.user.name,
  655. department: '',
  656. quoter: '',
  657. quoterName: '',
  658. tp: '',
  659. tpName: '',
  660. purchaser: '',
  661. totalCost: '',
  662. purchaserName: '',
  663. detailList:[],
  664. };
  665. this.visible=true;
  666. this.jumpFlag=true;
  667. },
  668. changeSum(row){
  669. if(row.standardCost<0||row.standardCost==null||row.standardCost==''){
  670. row.standardCost=0
  671. // this.$alert('成本不能为负数或者不填', '错误', {
  672. // confirmButtonText: '确定'
  673. // })
  674. }
  675. this.dataForm.applySumQty =0
  676. this.dataForm.totalCost =0
  677. for (const item of this.toolData) {
  678. // 累加之前先确保值存在,并将 null 或 undefined 转换为0
  679. this.dataForm.applySumQty += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty : 0);
  680. this.dataForm.totalCost += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty*item.standardCost : 0);
  681. }
  682. },
  683. saveData(){
  684. // for (let i = 0; i < this.toolData.length; i++) {
  685. // if(this.toolData[i].toolQuantity<this.toolData[i].applyQty){
  686. // this.$alert( '工具:'+this.toolData[i].toolNo +' 实际申请数量大于表单工具数量!', '错误', {
  687. // confirmButtonText: '确定'
  688. // })
  689. // return false;
  690. // }
  691. // }
  692. if(this.dataForm.applySumQty===0){
  693. this.$alert('未填写申请数量!', '错误', {
  694. confirmButtonText: '确定'
  695. })
  696. return false;
  697. }
  698. if(this.dataForm.applyBy===''||this.dataForm.applyBy==null){
  699. this.$alert('未选择申请人!', '错误', {
  700. confirmButtonText: '确定'
  701. })
  702. return false;
  703. }
  704. if(this.dataForm.applyDate===''||this.dataForm.applyDate==null){
  705. this.$alert('未选择申请日期!', '错误', {
  706. confirmButtonText: '确定'
  707. })
  708. return false;
  709. }
  710. if(this.dataForm.department===''||this.dataForm.department==null){
  711. this.$alert('未选择部门!', '错误', {
  712. confirmButtonText: '确定'
  713. })
  714. return false;
  715. }
  716. if(this.dataForm.quoter===''||this.dataForm.quoter==null){
  717. this.$alert('未选择报价员!', '错误', {
  718. confirmButtonText: '确定'
  719. })
  720. return false;
  721. }
  722. if(this.dataForm.tp===''||this.dataForm.tp==null){
  723. this.$alert('未选择TP!', '错误', {
  724. confirmButtonText: '确定'
  725. })
  726. return false;
  727. }
  728. if(this.dataForm.purchaser===''||this.dataForm.purchaser==null){
  729. this.$alert('未选择采购专员!', '错误', {
  730. confirmButtonText: '确定'
  731. })
  732. return false;
  733. }
  734. this.$confirm('确定要保存?', '提示', {
  735. confirmButtonText: '确定',
  736. cancelButtonText: '取消',
  737. type: 'warning'
  738. }).then(() => {
  739. for (let i = 0; i < this.toolData.length; i++) {
  740. if (this.toolData[i].applyQty===''||this.toolData[i].applyQty==null){
  741. this.toolData[i].applyQty=0
  742. }
  743. }
  744. this.dataForm.detailList=this.toolData.filter(item => item.applyQty > 0).filter(item => item.standardCost >= 0)
  745. saveProjectToolApply(this.dataForm).then(({data}) => {
  746. if (data && data.code == 0) {
  747. this.visible=false;
  748. this.initDataBtn();
  749. this.$message({
  750. message: '操作成功',
  751. type: 'success',
  752. duration: 1500,
  753. onClose: () => {
  754. }
  755. })
  756. if(this.jumpFlag){
  757. this.$nextTick(function () {
  758. setTimeout(() => {
  759. let inData = {
  760. site: this.$store.state.user.site,
  761. applyNo: data.applyNo,
  762. username: this.$store.state.user.name
  763. };
  764. localStorage.setItem('ToolApplyData', JSON.stringify(inData))
  765. this.$router.push('tooling-searchToolApply')
  766. },500)
  767. })
  768. }
  769. } else {
  770. this.$alert(data.msg, '错误', {
  771. confirmButtonText: '确定'
  772. })
  773. }
  774. })
  775. }).catch(() => {
  776. })
  777. },
  778. //导出excel
  779. //导出excel
  780. async createExportData() {
  781. // this.searchData.limit = -1
  782. // this.searchData.page = 1
  783. // await projectInfoSearch(this.searchData).then(({data}) => {
  784. // this.exportList= data.page.list;
  785. // })
  786. //
  787. // return this.exportList;
  788. },
  789. startDownload() {
  790. // this.exportData = this.dataList
  791. },
  792. finishDownload() {
  793. },
  794. fields() {
  795. let json = "{"
  796. this.columnList1.forEach((item, index) => {
  797. if (index == this.columnList1.length - 1) {
  798. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  799. } else {
  800. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  801. }
  802. })
  803. json += "}"
  804. let s = eval("(" + json + ")")
  805. return s
  806. },
  807. fieldColumn(){
  808. if(!this.accessField('10601001')){
  809. this.columnList2=this.columnList2.filter(item => item.columnProp !== 'standardCost');
  810. }
  811. },
  812. },
  813. }
  814. </script>
  815. <style scoped>
  816. </style>