engin_list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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="small" 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" size="medium" @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.date"
  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="选择业务员" size="small" 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 size="small" @click="resetScreenForm">清空</el-button>
  88. <el-button size="small" 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="small" 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="center" label="工程信息单" prop="enginInfoNo" min-width="200" show-overflow-tooltip></el-table-column>
  115. <el-table-column align="center" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <div>
  118. <span>{{scope.row.orderDate | dateToDayFilter}}</span>
  119. <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>
  120. </div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" label="经销商编码" prop="customerId" min-width="120" show-overflow-tooltip></el-table-column>
  124. <el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
  125. <el-table-column align="center" label="工程名称" prop="projectName" min-width="160" show-overflow-tooltip></el-table-column>
  126. <el-table-column align="center" label="使用单位" prop="useUnit" min-width="160" show-overflow-tooltip></el-table-column>
  127. <el-table-column align="center" label="安装地址" prop="installAddress" min-width="160" show-overflow-tooltip></el-table-column>
  128. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  129. <el-table-column align="center" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  130. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  131. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  132. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  133. <el-table-column align="right" label="数量" prop="qty" min-width="100" sortable show-overflow-tooltip></el-table-column>
  134. <el-table-column align="right" label="金额" prop="totalAmount" min-width="100" sortable show-overflow-tooltip>
  135. <template slot-scope="scope">
  136. {{scope.row.totalAmount | numToFixed}}
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="center" label="制表人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  140. <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  141. <el-table-column align="center" label="审核人" prop="confirmBy" min-width="100" show-overflow-tooltip></el-table-column>
  142. <el-table-column align="center" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
  143. <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  144. <template slot-scope="scope">
  145. {{scope.row.examineStatus | statusFilter}}
  146. </template>
  147. </el-table-column>
  148. <el-table-column align="center" label="操作" width="180" fixed="right">
  149. <template slot-scope="scope">
  150. <el-popconfirm
  151. style="margin-right: 10px;"
  152. title="确定申请吗?"
  153. @onConfirm="handleSubmit(scope.row.enginInfoId)"
  154. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  155. <el-button slot="reference" type="text">申请</el-button>
  156. </el-popconfirm>
  157. <el-popconfirm
  158. style="margin-right: 10px;"
  159. title="确定撤回吗?"
  160. @onConfirm="handleWithdraw(scope.row.enginInfoId)"
  161. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  162. <el-button slot="reference" type="text">撤回</el-button>
  163. </el-popconfirm>
  164. <el-popconfirm
  165. style="margin-right: 10px;"
  166. title="确定弃审吗?"
  167. @onConfirm="handleAbandon(scope.row.enginInfoId)"
  168. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  169. <el-button slot="reference" type="text">弃审</el-button>
  170. </el-popconfirm>
  171. <el-button
  172. type="text"
  173. @click="toForm(scope.row)"
  174. v-if="$checkBtnRole('edit', $route.meta.roles) && scope.row.examineStatus === 'SAVE'">
  175. 编辑
  176. </el-button>
  177. <el-button
  178. type="text"
  179. @click="toExamine(scope.row)"
  180. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  181. 审批
  182. </el-button>
  183. <el-button
  184. type="text"
  185. @click="toDetail(scope.row)">
  186. 详情
  187. </el-button>
  188. <el-popconfirm
  189. style="margin-left: 10px;"
  190. title="确定删除吗?"
  191. @onConfirm="handleDelete(scope.row.enginInfoId)"
  192. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  193. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  194. </el-popconfirm>
  195. </template>
  196. </el-table-column>
  197. </el-table>
  198. </div>
  199. </div>
  200. <div class="pagination clearfix">
  201. <div class="fr">
  202. <el-pagination
  203. @size-change="handleSizeChange"
  204. @current-change="handleCurrentChange"
  205. :current-page="currentPage"
  206. :page-sizes="[10, 20, 30, 50]"
  207. :page-size="10"
  208. layout="total, sizes, prev, pager, next, jumper"
  209. :total="listTotal">
  210. </el-pagination>
  211. </div>
  212. </div>
  213. </div>
  214. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  215. <EnginDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  216. <EnginForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  217. <EnginExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  218. </div>
  219. </template>
  220. <script>
  221. import { getEnginList, applyEngin, withdrawEngin, deleteEngin, editDateEngin, abandonEngin } from "@/api/supply/engin";
  222. import { getSalesmanList } from '@/api/common'
  223. import EnginDetail from "@/views/supply/engin/components/engin_detail";
  224. import EnginForm from "@/views/supply/engin/components/engin_form";
  225. import EnginExamine from "@/views/supply/engin/components/engin_examine";
  226. import EditDateDialog from "@/components/Common/edit-date-dialog";
  227. let that
  228. export default {
  229. components: {
  230. EnginDetail,
  231. EnginForm,
  232. EnginExamine,
  233. EditDateDialog,
  234. },
  235. filters: {
  236. statusFilter(val) {
  237. let obj = that.statusList.find(o => o.value == val);
  238. return obj ? obj.label : ''
  239. }
  240. },
  241. data() {
  242. return {
  243. currentPage: 1, // 当前页码
  244. pageSize: 10, // 每页数量
  245. listTotal: 0, // 列表总数
  246. dataList: null, // 列表数据
  247. listLoading: false, // 列表加载loading
  248. screenForm: { // 筛选表单数据
  249. orderNum: '',
  250. enginNum: '',
  251. loginNum: '',
  252. enginName: '',
  253. date: '',
  254. dealer: '',
  255. company: '',
  256. createMan: '',
  257. examineMan: '',
  258. status: [],
  259. salesMan: '',
  260. model: '',
  261. },
  262. statusList: [
  263. { label: '已保存', value: 'SAVE' },
  264. { label: '待审核', value: 'WAIT' },
  265. { label: '审核通过', value: 'OK' },
  266. { label: '审核驳回', value: 'FAIL' },
  267. { label: '已关闭', value: 'CLOSE' },
  268. ],
  269. salesmanList: [],
  270. queryItem: {},
  271. isShowDetail: false,
  272. isShowForm: false,
  273. isShowExamine: false,
  274. editId: null,
  275. isShowEditDateDialog: false,
  276. dateForm: {
  277. date: '',
  278. },
  279. }
  280. },
  281. computed: {
  282. exParams() {
  283. return {
  284. enginInfoNo: this.screenForm.orderNum,
  285. projectNo: this.screenForm.enginNum,
  286. enginSignType: this.screenForm.loginNum,
  287. projectName: this.screenForm.enginName,
  288. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  289. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  290. customerKeyWord: this.screenForm.dealer,
  291. useUnit: this.screenForm.company,
  292. createName: this.screenForm.createMan,
  293. confirmName: this.screenForm.examineMan,
  294. examineStatus: this.screenForm.status.join(','),
  295. serviceId: this.screenForm.salesMan,
  296. specification: this.screenForm.model,
  297. }
  298. },
  299. },
  300. beforeCreate() {
  301. that = this;
  302. },
  303. created() {
  304. this.getSalesmanList();
  305. this.getList();
  306. },
  307. methods: {
  308. // 获取业务员列表
  309. getSalesmanList() {
  310. getSalesmanList({
  311. pageNum: 1,
  312. pageSize: -1,
  313. isCustomer: 0,
  314. status: true,
  315. }).then(res => {
  316. this.salesmanList = res.data.records;
  317. })
  318. },
  319. // 查询列表
  320. getList() {
  321. this.listLoading = true;
  322. let params = {
  323. pageNum: this.currentPage,
  324. pageSize: this.pageSize,
  325. enginInfoNo: this.screenForm.orderNum,
  326. projectNo: this.screenForm.enginNum,
  327. enginSignType: this.screenForm.loginNum,
  328. projectName: this.screenForm.enginName,
  329. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  330. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  331. customerKeyword: this.screenForm.dealer,
  332. useUnit: this.screenForm.company,
  333. createName: this.screenForm.createMan,
  334. confirmName: this.screenForm.examineMan,
  335. examineStatus: this.screenForm.status.join(','),
  336. serviceId: this.screenForm.salesMan,
  337. specification: this.screenForm.model,
  338. };
  339. getEnginList(params).then((res) => {
  340. res.data.records.forEach(item => {
  341. item.sums1 = ['qty'];
  342. item.sums2 = ['totalAmount'];
  343. })
  344. this.dataList = res.data.records;
  345. this.listTotal = res.data.total;
  346. this.listLoading = false;
  347. })
  348. },
  349. // 提交筛选表单
  350. submitScreenForm() {
  351. this.currentPage = 1;
  352. this.getList();
  353. },
  354. // 重置筛选表单
  355. resetScreenForm() {
  356. this.$refs.screenForm.resetFields();
  357. this.currentPage = 1;
  358. this.getList();
  359. },
  360. // 更改每页数量
  361. handleSizeChange(val) {
  362. this.pageSize = val;
  363. this.currentPage = 1;
  364. this.getList();
  365. },
  366. // 更改当前页
  367. handleCurrentChange(val) {
  368. this.currentPage = val;
  369. this.getList();
  370. },
  371. // 进入表单
  372. toForm(item) {
  373. this.queryItem = item;
  374. this.isShowForm = true;
  375. },
  376. // 进入审批
  377. toExamine(item) {
  378. this.queryItem = item;
  379. this.isShowExamine = true;
  380. },
  381. // 进入详情
  382. toDetail(item) {
  383. this.queryItem = item;
  384. this.isShowDetail = true;
  385. },
  386. backList() {
  387. this.queryItem = {};
  388. this.isShowDetail = false;
  389. this.isShowForm = false;
  390. this.isShowExamine = false;
  391. },
  392. // 申请
  393. handleSubmit(id) {
  394. applyEngin({id}).then(res => {
  395. this.$successMsg();
  396. this.getList();
  397. })
  398. },
  399. // 撤回
  400. handleWithdraw(id) {
  401. withdrawEngin({id}).then(res => {
  402. this.$successMsg();
  403. this.getList();
  404. })
  405. },
  406. // 弃审
  407. handleAbandon(id) {
  408. abandonEngin({id}).then(res => {
  409. this.$successMsg();
  410. this.getList();
  411. })
  412. },
  413. // 删除
  414. handleDelete(id) {
  415. deleteEngin({ids: id}).then(res => {
  416. this.$successMsg();
  417. this.getList();
  418. })
  419. },
  420. // 打开 修改订单日期
  421. editDate(item) {
  422. this.editId = item.enginInfoId;
  423. this.dateForm.date = item.orderDate.slice(0, 10);
  424. this.isShowEditDateDialog = true;
  425. },
  426. // 提交 修改订单日期
  427. submitDateForm() {
  428. editDateEngin({
  429. enginInfoId: this.editId,
  430. orderDate: this.dateForm.date + ' 00:00:00',
  431. }).then(res => {
  432. this.isShowEditDateDialog = false;
  433. this.getList();
  434. this.$successMsg('修改成功');
  435. })
  436. },
  437. }
  438. }
  439. </script>
  440. <style lang="scss" scoped>
  441. </style>