engin_list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowForm && !isShowExamine">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="100px" size="mini" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="24" :lg="24">
  9. <el-form-item prop="status" label-width="0">
  10. <el-checkbox-group v-model="screenForm.status" @change="getList()">
  11. <el-checkbox-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-checkbox-button>
  12. </el-checkbox-group>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="工程信息单号" prop="orderNum">
  17. <el-input v-model="screenForm.orderNum" placeholder="请输入工程信息单号"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :lg="6">
  21. <el-form-item label="工程编码" prop="enginNum">
  22. <el-input v-model="screenForm.enginNum" placeholder="请输入工程编码"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :sm="12" :lg="6">
  26. <el-form-item label="工程登录编号" prop="loginNum">
  27. <el-input v-model="screenForm.loginNum" placeholder="请输入工程登录编号"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="12" :lg="6">
  31. <el-form-item label="项目名称" prop="enginName">
  32. <el-input v-model="screenForm.enginName" placeholder="请输入项目名称"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :xs="24" :sm="12" :lg="6">
  36. <el-form-item label="单据日期" prop="date">
  37. <el-date-picker
  38. v-model="screenForm.orderDate"
  39. type="datetimerange"
  40. range-separator="至"
  41. style="width: 100%;"
  42. value-format="yyyy-MM-dd HH:mm:ss"
  43. start-placeholder="开始日期"
  44. end-placeholder="结束日期">
  45. </el-date-picker>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :xs="24" :sm="12" :lg="6">
  49. <el-form-item label="经销商" prop="dealer">
  50. <el-input v-model="screenForm.dealer" placeholder="请输入经销商"></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :xs="24" :sm="12" :lg="6">
  54. <el-form-item label="使用单位" prop="company">
  55. <el-input v-model="screenForm.company" placeholder="请输入使用单位"></el-input>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :xs="24" :sm="12" :lg="6">
  59. <el-form-item label="制表人" prop="createMan">
  60. <el-input v-model="screenForm.createMan" placeholder="请输入制表人"></el-input>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :lg="6">
  64. <el-form-item label="审核人" prop="examineMan">
  65. <el-input v-model="screenForm.examineMan" placeholder="请输入审核人"></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :xs="24" :sm="12" :lg="6">
  69. <el-form-item label="业务员" prop="salesMan">
  70. <el-select v-model="screenForm.salesMan" placeholder="选择业务员" clearable filterable style="width: 100%">
  71. <el-option
  72. v-for="item in salesmanList"
  73. :key="item.adminUserId"
  74. :label="item.nickName"
  75. :value="item.adminUserId">
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :xs="24" :sm="12" :lg="6">
  81. <el-form-item label="规格型号" prop="model">
  82. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  83. </el-form-item>
  84. </el-col>
  85. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  86. <el-form-item label="">
  87. <el-button @click="resetScreenForm">清空</el-button>
  88. <el-button type="primary" @click="submitScreenForm">搜索</el-button>
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. </el-form>
  93. </div>
  94. <div class="mymain-container">
  95. <div class="btn-group clearfix">
  96. <div class="fl">
  97. <el-button size="mini" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">新增</el-button>
  98. </div>
  99. <div class="fr">
  100. <ExportButton :exUrl="'engin-info-order/export'" :exParams="exParams" />
  101. </div>
  102. </div>
  103. <div class="table">
  104. <el-table
  105. v-loading="listLoading"
  106. :data="dataList"
  107. element-loading-text="Loading"
  108. border
  109. fit
  110. highlight-current-row
  111. stripe
  112. show-summary
  113. :summary-method="$getSummaries">
  114. <el-table-column align="left" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  115. <template slot-scope="scope">
  116. {{scope.row.examineStatus | statusFilter}}
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="left" label="工程信息单号" prop="enginInfoNo" min-width="150" show-overflow-tooltip>
  120. <template slot-scope="scope">
  121. <CopyButton :copyText="scope.row.enginInfoNo" />
  122. <span>{{scope.row.enginInfoNo}}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column align="left" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
  126. <template slot-scope="scope">
  127. <div>
  128. <span>{{scope.row.orderDate | dateToDayFilter}}</span>
  129. <el-button type="text" icon="el-icon-edit" style="padding: 0; margin-left: 6px" @click="editDate(scope.row)" v-if="$checkBtnRole('date', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'WAIT')" ></el-button>
  130. </div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
  134. <template slot-scope="scope">
  135. <CopyButton :copyText="scope.row.customerNumber" />
  136. <span>{{scope.row.customerNumber}}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  140. <template slot-scope="scope">
  141. <CopyButton :copyText="scope.row.customerName" />
  142. <span>{{scope.row.customerName}}</span>
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="left" label="项目类别" prop="projectName" min-width="160" show-overflow-tooltip></el-table-column>
  146. <el-table-column align="left" label="使用单位" prop="useUnit" min-width="160" show-overflow-tooltip></el-table-column>
  147. <el-table-column align="left" label="安装地址" prop="installAddress" min-width="160" show-overflow-tooltip></el-table-column>
  148. <el-table-column align="left" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip>
  149. <template slot-scope="scope">
  150. <CopyButton :copyText="scope.row.materialNumber" />
  151. <span>{{scope.row.materialNumber}}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  155. <template slot-scope="scope">
  156. <CopyButton :copyText="scope.row.materialOldNumber" />
  157. <span>{{scope.row.materialOldNumber}}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  161. <template slot-scope="scope">
  162. <CopyButton :copyText="scope.row.materialName" />
  163. <span>{{scope.row.materialName}}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  167. <template slot-scope="scope">
  168. <CopyButton :copyText="scope.row.specification" />
  169. <span>{{scope.row.specification}}</span>
  170. </template>
  171. </el-table-column>
  172. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  173. <el-table-column align="right" label="数量" prop="qty" min-width="100" sortable show-overflow-tooltip></el-table-column>
  174. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  175. <template slot-scope="scope">
  176. {{scope.row.price | numToFixed}}
  177. </template>
  178. </el-table-column>
  179. <el-table-column align="right" label="金额" prop="totalAmount" min-width="100" sortable show-overflow-tooltip>
  180. <template slot-scope="scope">
  181. {{scope.row.totalAmount | numToFixed}}
  182. </template>
  183. </el-table-column>
  184. <el-table-column align="right" label="已订数量" prop="hasOrderQty" min-width="100" show-overflow-tooltip></el-table-column>
  185. <el-table-column align="right" label="可订数量" min-width="100" show-overflow-tooltip>
  186. <template slot-scope="scope">
  187. {{ computeAllowQty(scope.row.qty, scope.row.hasOrderQty)}}
  188. </template>
  189. </el-table-column>
  190. <el-table-column align="left" label="表体业务员" prop="itemServiceName" min-width="100" show-overflow-tooltip></el-table-column>
  191. <el-table-column align="left" label="表头业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  192. <el-table-column align="left" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  193. <el-table-column align="left" label="制表人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  194. <el-table-column align="left" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  195. <el-table-column align="left" label="审核人" prop="confirmBy" min-width="100" show-overflow-tooltip></el-table-column>
  196. <el-table-column align="left" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
  197. <el-table-column align="center" label="操作" width="210" fixed="right">
  198. <template slot-scope="scope">
  199. <el-popconfirm
  200. style="margin-right: 10px;"
  201. title="确定申请吗?"
  202. @onConfirm="handleSubmit(scope.row.enginInfoId)"
  203. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  204. <el-button slot="reference" type="text">申请</el-button>
  205. </el-popconfirm>
  206. <el-popconfirm
  207. style="margin-right: 10px;"
  208. title="确定撤回吗?"
  209. @onConfirm="handleWithdraw(scope.row.enginInfoId)"
  210. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  211. <el-button slot="reference" type="text">撤回</el-button>
  212. </el-popconfirm>
  213. <el-popconfirm
  214. style="margin-right: 10px;"
  215. title="确定弃审吗?"
  216. @onConfirm="handleAbandon(scope.row.enginInfoId)"
  217. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  218. <el-button slot="reference" type="text">弃审</el-button>
  219. </el-popconfirm>
  220. <el-button
  221. type="text"
  222. @click="toForm(scope.row)"
  223. v-if="$checkBtnRole('edit', $route.meta.roles) && (!isDealer || (isDealer && scope.row.examineStatus === 'SAVE'))">
  224. 编辑
  225. </el-button>
  226. <el-button
  227. type="text"
  228. @click="toExamine(scope.row)"
  229. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  230. 审批
  231. </el-button>
  232. <el-button
  233. type="text"
  234. @click="toDetail(scope.row)">
  235. 详情
  236. </el-button>
  237. <el-popconfirm
  238. style="margin-left: 10px;"
  239. title="确定删除吗?"
  240. @onConfirm="handleDelete(scope.row.enginInfoId)"
  241. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  242. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  243. </el-popconfirm>
  244. </template>
  245. </el-table-column>
  246. </el-table>
  247. </div>
  248. </div>
  249. <div class="pagination clearfix">
  250. <div class="fr">
  251. <el-pagination
  252. @size-change="handleSizeChange"
  253. @current-change="handleCurrentChange"
  254. :current-page="currentPage"
  255. :page-sizes="[10, 20, 30, 50]"
  256. :page-size="10"
  257. layout="total, sizes, prev, pager, next, jumper"
  258. :total="listTotal">
  259. </el-pagination>
  260. </div>
  261. </div>
  262. </div>
  263. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  264. <EnginDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  265. <EnginForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  266. <EnginExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  267. </div>
  268. </template>
  269. <script>
  270. import { getEnginList, applyEngin, withdrawEngin, deleteEngin, editDateEngin, abandonEngin } from "@/api/supply/engin";
  271. import { getSalesmanList } from '@/api/common'
  272. import EnginDetail from "@/views/supply/engin/components/engin_detail";
  273. import EnginForm from "@/views/supply/engin/components/engin_form";
  274. import EnginExamine from "@/views/supply/engin/components/engin_examine";
  275. import EditDateDialog from "@/components/Common/edit-date-dialog";
  276. let that
  277. export default {
  278. components: {
  279. EnginDetail,
  280. EnginForm,
  281. EnginExamine,
  282. EditDateDialog,
  283. },
  284. filters: {
  285. statusFilter(val) {
  286. let obj = that.statusList.find(o => o.value == val);
  287. return obj ? obj.label : ''
  288. }
  289. },
  290. data() {
  291. return {
  292. currentPage: 1, // 当前页码
  293. pageSize: 10, // 每页数量
  294. listTotal: 0, // 列表总数
  295. dataList: null, // 列表数据
  296. listLoading: false, // 列表加载loading
  297. screenForm: { // 筛选表单数据
  298. orderNum: '',
  299. enginNum: '',
  300. loginNum: '',
  301. enginName: '',
  302. date: '',
  303. dealer: '',
  304. company: '',
  305. createMan: '',
  306. examineMan: '',
  307. status: [],
  308. salesMan: '',
  309. model: '',
  310. orderDate: ''
  311. },
  312. statusList: [
  313. { label: '已保存', value: 'SAVE' },
  314. { label: '待审核', value: 'WAIT' },
  315. { label: '审核通过', value: 'OK' },
  316. // // { label: '审核驳回', value: 'FAIL' },,
  317. { label: '已关闭', value: 'CLOSE' },
  318. ],
  319. salesmanList: [],
  320. queryItem: {},
  321. isShowDetail: false,
  322. isShowForm: false,
  323. isShowExamine: false,
  324. editId: null,
  325. isShowEditDateDialog: false,
  326. dateForm: {
  327. date: '',
  328. },
  329. }
  330. },
  331. computed: {
  332. isDealer() {
  333. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  334. },
  335. exParams() {
  336. return {
  337. enginInfoNo: this.screenForm.orderNum,
  338. projectNo: this.screenForm.enginNum,
  339. enginSignType: this.screenForm.loginNum,
  340. projectName: this.screenForm.enginName,
  341. startOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[0] : '',
  342. endOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[1] : '',
  343. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  344. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  345. customerKeyWord: this.screenForm.dealer,
  346. useUnit: this.screenForm.company,
  347. createName: this.screenForm.createMan,
  348. confirmName: this.screenForm.examineMan,
  349. examineStatus: this.screenForm.status.join(','),
  350. serviceId: this.screenForm.salesMan,
  351. specification: this.screenForm.model,
  352. }
  353. },
  354. },
  355. beforeCreate() {
  356. that = this;
  357. },
  358. created() {
  359. this.getSalesmanList();
  360. this.getList();
  361. },
  362. methods: {
  363. // 获取业务员列表
  364. getSalesmanList() {
  365. getSalesmanList({
  366. pageNum: 1,
  367. pageSize: -1,
  368. isCustomer: 0,
  369. status: true,
  370. }).then(res => {
  371. this.salesmanList = res.data.records;
  372. })
  373. },
  374. // 查询列表
  375. getList() {
  376. this.listLoading = true;
  377. let params = {
  378. pageNum: this.currentPage,
  379. pageSize: this.pageSize,
  380. enginInfoNo: this.screenForm.orderNum,
  381. projectNo: this.screenForm.enginNum,
  382. enginSignType: this.screenForm.loginNum,
  383. projectName: this.screenForm.enginName,
  384. startOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[0] : '',
  385. endOrderDate: this.screenForm.orderDate ? this.screenForm.orderDate[1] : '',
  386. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  387. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  388. customerKeyword: this.screenForm.dealer,
  389. useUnit: this.screenForm.company,
  390. createName: this.screenForm.createMan,
  391. confirmName: this.screenForm.examineMan,
  392. examineStatus: this.screenForm.status.join(','),
  393. serviceId: this.screenForm.salesMan,
  394. specification: this.screenForm.model,
  395. };
  396. getEnginList(params).then((res) => {
  397. res.data.records.forEach(item => {
  398. item.sums1 = ['qty'];
  399. item.sums2 = ['totalAmount'];
  400. })
  401. this.dataList = res.data.records;
  402. this.listTotal = res.data.total;
  403. this.listLoading = false;
  404. })
  405. },
  406. // 提交筛选表单
  407. submitScreenForm() {
  408. this.currentPage = 1;
  409. this.getList();
  410. },
  411. // 重置筛选表单
  412. resetScreenForm() {
  413. this.$refs.screenForm.resetFields();
  414. this.currentPage = 1;
  415. this.getList();
  416. },
  417. // 更改每页数量
  418. handleSizeChange(val) {
  419. this.pageSize = val;
  420. this.currentPage = 1;
  421. this.getList();
  422. },
  423. // 更改当前页
  424. handleCurrentChange(val) {
  425. this.currentPage = val;
  426. this.getList();
  427. },
  428. // 进入表单
  429. toForm(item) {
  430. this.queryItem = item;
  431. this.isShowForm = true;
  432. },
  433. // 进入审批
  434. toExamine(item) {
  435. this.queryItem = item;
  436. this.isShowExamine = true;
  437. },
  438. // 进入详情
  439. toDetail(item) {
  440. this.queryItem = item;
  441. this.isShowDetail = true;
  442. },
  443. backList() {
  444. this.queryItem = {};
  445. this.isShowDetail = false;
  446. this.isShowForm = false;
  447. this.isShowExamine = false;
  448. },
  449. // 申请
  450. handleSubmit(id) {
  451. applyEngin({id}).then(res => {
  452. this.$successMsg();
  453. this.getList();
  454. })
  455. },
  456. // 撤回
  457. handleWithdraw(id) {
  458. withdrawEngin({id}).then(res => {
  459. this.$successMsg();
  460. this.getList();
  461. })
  462. },
  463. // 弃审
  464. handleAbandon(id) {
  465. abandonEngin({id}).then(res => {
  466. this.$successMsg();
  467. this.getList();
  468. })
  469. },
  470. // 删除
  471. handleDelete(id) {
  472. deleteEngin({ids: id}).then(res => {
  473. this.$successMsg();
  474. this.getList();
  475. })
  476. },
  477. // 打开 修改订单日期
  478. editDate(item) {
  479. this.editId = item.enginInfoId;
  480. this.dateForm.date = item.orderDate.slice(0, 10);
  481. this.isShowEditDateDialog = true;
  482. },
  483. // 提交 修改订单日期
  484. submitDateForm() {
  485. editDateEngin({
  486. enginInfoId: this.editId,
  487. orderDate: this.dateForm.date + ' 00:00:00',
  488. }).then(res => {
  489. this.isShowEditDateDialog = false;
  490. this.getList();
  491. this.$successMsg('修改成功');
  492. })
  493. },
  494. computeAllowQty(qty = 0, hasOrderQty = 0) {
  495. let allowQty = qty - hasOrderQty
  496. if (allowQty < 0) {
  497. return 0;
  498. }
  499. return allowQty;
  500. }
  501. }
  502. }
  503. </script>
  504. <style lang="scss" scoped>
  505. </style>