engin_list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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="18" class="tr">
  69. <el-form-item label="">
  70. <el-button size="small" @click="resetScreenForm">清空</el-button>
  71. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. </el-form>
  76. </div>
  77. <div class="mymain-container">
  78. <div class="btn-group clearfix">
  79. <div class="fl">
  80. <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">新增</el-button>
  81. </div>
  82. <div class="fr">
  83. <ExportButton :exUrl="'engin-info-order/export'" :exParams="exParams" />
  84. </div>
  85. </div>
  86. <div class="table">
  87. <el-table
  88. v-loading="listLoading"
  89. :data="dataList"
  90. element-loading-text="Loading"
  91. border
  92. fit
  93. highlight-current-row
  94. stripe
  95. show-summary
  96. :summary-method="$getSummaries">
  97. <el-table-column align="center" label="工程信息单" prop="enginInfoNo" min-width="200" show-overflow-tooltip></el-table-column>
  98. <el-table-column align="center" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. <div>
  101. <span>{{scope.row.orderDate | dateToDayFilter}}</span>
  102. <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>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" label="经销商编码" prop="customerId" min-width="120" show-overflow-tooltip></el-table-column>
  107. <el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
  108. <el-table-column align="center" label="工程名称" prop="projectName" min-width="160" show-overflow-tooltip></el-table-column>
  109. <el-table-column align="center" label="使用单位" prop="useUnit" min-width="160" show-overflow-tooltip></el-table-column>
  110. <el-table-column align="center" label="安装地址" prop="installAddress" min-width="160" show-overflow-tooltip></el-table-column>
  111. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  112. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  113. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  114. <el-table-column align="right" label="数量" prop="qty" min-width="100" sortable show-overflow-tooltip></el-table-column>
  115. <el-table-column align="right" label="金额" prop="totalAmount" min-width="100" sortable show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. {{scope.row.totalAmount | numToFixed}}
  118. </template>
  119. </el-table-column>
  120. <el-table-column align="center" label="制表人" prop="createName" min-width="100" show-overflow-tooltip></el-table-column>
  121. <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  122. <el-table-column align="center" label="审核人" prop="confirmName" min-width="100" show-overflow-tooltip></el-table-column>
  123. <el-table-column align="center" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
  124. <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  125. <template slot-scope="scope">
  126. {{scope.row.examineStatus | statusFilter}}
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="center" label="操作" width="180" fixed="right">
  130. <template slot-scope="scope">
  131. <el-popconfirm
  132. style="margin-right: 10px;"
  133. title="确定申请吗?"
  134. @onConfirm="handleSubmit(scope.row.enginInfoId)"
  135. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  136. <el-button slot="reference" type="text">申请</el-button>
  137. </el-popconfirm>
  138. <el-popconfirm
  139. style="margin-right: 10px;"
  140. title="确定撤回吗?"
  141. @onConfirm="handleWithdraw(scope.row.enginInfoId)"
  142. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  143. <el-button slot="reference" type="text">撤回</el-button>
  144. </el-popconfirm>
  145. <el-button
  146. type="text"
  147. @click="toForm(scope.row)"
  148. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'OK')">
  149. 编辑
  150. </el-button>
  151. <el-button
  152. type="text"
  153. @click="toExamine(scope.row)"
  154. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  155. 审批
  156. </el-button>
  157. <el-button
  158. type="text"
  159. @click="toDetail(scope.row)">
  160. 详情
  161. </el-button>
  162. <el-popconfirm
  163. style="margin-left: 10px;"
  164. title="确定删除吗?"
  165. @onConfirm="handleDelete(scope.row.enginInfoId)"
  166. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  167. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  168. </el-popconfirm>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. </div>
  173. </div>
  174. <div class="pagination clearfix">
  175. <div class="fr">
  176. <el-pagination
  177. @size-change="handleSizeChange"
  178. @current-change="handleCurrentChange"
  179. :current-page="currentPage"
  180. :page-sizes="[10, 20, 30, 50]"
  181. :page-size="10"
  182. layout="total, sizes, prev, pager, next, jumper"
  183. :total="listTotal">
  184. </el-pagination>
  185. </div>
  186. </div>
  187. </div>
  188. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  189. <EnginDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  190. <EnginForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  191. <EnginExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  192. </div>
  193. </template>
  194. <script>
  195. import { getEnginList, applyEngin, withdrawEngin, deleteEngin, editDateEngin } from "@/api/supply/engin";
  196. import EnginDetail from "@/views/supply/engin/components/engin_detail";
  197. import EnginForm from "@/views/supply/engin/components/engin_form";
  198. import EnginExamine from "@/views/supply/engin/components/engin_examine";
  199. import EditDateDialog from "@/components/Common/edit-date-dialog";
  200. let that
  201. export default {
  202. components: {
  203. EnginDetail,
  204. EnginForm,
  205. EnginExamine,
  206. EditDateDialog,
  207. },
  208. filters: {
  209. statusFilter(val) {
  210. let obj = that.statusList.find(o => o.value == val);
  211. return obj ? obj.label : ''
  212. }
  213. },
  214. data() {
  215. return {
  216. currentPage: 1, // 当前页码
  217. pageSize: 10, // 每页数量
  218. listTotal: 0, // 列表总数
  219. dataList: null, // 列表数据
  220. listLoading: false, // 列表加载loading
  221. screenForm: { // 筛选表单数据
  222. orderNum: '',
  223. enginNum: '',
  224. loginNum: '',
  225. enginName: '',
  226. date: '',
  227. dealer: '',
  228. company: '',
  229. createMan: '',
  230. examineMan: '',
  231. status: [],
  232. },
  233. statusList: [
  234. { label: '已保存', value: 'SAVE' },
  235. { label: '待审核', value: 'WAIT' },
  236. { label: '审核通过', value: 'OK' },
  237. { label: '审核驳回', value: 'FAIL' },
  238. { label: '已关闭', value: 'CLOSE' },
  239. ],
  240. queryItem: {},
  241. isShowDetail: false,
  242. isShowForm: false,
  243. isShowExamine: false,
  244. editId: null,
  245. isShowEditDateDialog: false,
  246. dateForm: {
  247. date: '',
  248. },
  249. }
  250. },
  251. computed: {
  252. exParams() {
  253. return {
  254. enginInfoNo: this.screenForm.orderNum,
  255. projectNo: this.screenForm.enginNum,
  256. enginSignType: this.screenForm.loginNum,
  257. projectName: this.screenForm.enginName,
  258. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  259. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  260. customerKeyWord: this.screenForm.dealer,
  261. useUnit: this.screenForm.company,
  262. createName: this.screenForm.createMan,
  263. confirmName: this.screenForm.examineMan,
  264. examineStatus: this.screenForm.status.join(','),
  265. }
  266. },
  267. },
  268. beforeCreate() {
  269. that = this;
  270. },
  271. created() {
  272. this.getList();
  273. },
  274. methods: {
  275. // 查询列表
  276. getList() {
  277. this.listLoading = true;
  278. let params = {
  279. pageNum: this.currentPage,
  280. pageSize: this.pageSize,
  281. enginInfoNo: this.screenForm.orderNum,
  282. projectNo: this.screenForm.enginNum,
  283. enginSignType: this.screenForm.loginNum,
  284. projectName: this.screenForm.enginName,
  285. startContractExpireDate: this.screenForm.date ? this.screenForm.date[0] : '',
  286. endContractExpireDate: this.screenForm.date ? this.screenForm.date[1] : '',
  287. customerKeyWord: this.screenForm.dealer,
  288. useUnit: this.screenForm.company,
  289. createName: this.screenForm.createMan,
  290. confirmName: this.screenForm.examineMan,
  291. examineStatus: this.screenForm.status.join(','),
  292. };
  293. getEnginList(params).then((res) => {
  294. res.data.records.forEach(item => {
  295. item.sums1 = ['qty'];
  296. item.sums2 = ['totalAmount'];
  297. })
  298. this.dataList = res.data.records;
  299. this.listTotal = res.data.total;
  300. this.listLoading = false;
  301. })
  302. },
  303. // 提交筛选表单
  304. submitScreenForm() {
  305. this.currentPage = 1;
  306. this.getList();
  307. },
  308. // 重置筛选表单
  309. resetScreenForm() {
  310. this.$refs.screenForm.resetFields();
  311. this.currentPage = 1;
  312. this.getList();
  313. },
  314. // 更改每页数量
  315. handleSizeChange(val) {
  316. this.pageSize = val;
  317. this.currentPage = 1;
  318. this.getList();
  319. },
  320. // 更改当前页
  321. handleCurrentChange(val) {
  322. this.currentPage = val;
  323. this.getList();
  324. },
  325. // 进入表单
  326. toForm(item) {
  327. this.queryItem = item;
  328. this.isShowForm = true;
  329. },
  330. // 进入审批
  331. toExamine(item) {
  332. this.queryItem = item;
  333. this.isShowExamine = true;
  334. },
  335. // 进入详情
  336. toDetail(item) {
  337. this.queryItem = item;
  338. this.isShowDetail = true;
  339. },
  340. backList() {
  341. this.queryItem = {};
  342. this.isShowDetail = false;
  343. this.isShowForm = false;
  344. this.isShowExamine = false;
  345. },
  346. // 申请
  347. handleSubmit(id) {
  348. applyEngin({id}).then(res => {
  349. this.$successMsg();
  350. this.getList();
  351. })
  352. },
  353. // 撤回
  354. handleWithdraw(id) {
  355. withdrawEngin({id}).then(res => {
  356. this.$successMsg();
  357. this.getList();
  358. })
  359. },
  360. // 删除
  361. handleDelete(id) {
  362. deleteEngin({ids: id}).then(res => {
  363. this.$successMsg();
  364. this.getList();
  365. })
  366. },
  367. // 打开 修改订单日期
  368. editDate(item) {
  369. this.editId = item.enginInfoId;
  370. this.dateForm.date = item.orderDate.slice(0, 10);
  371. this.isShowEditDateDialog = true;
  372. },
  373. // 提交 修改订单日期
  374. submitDateForm() {
  375. editDateEngin({
  376. enginInfoId: this.editId,
  377. orderDate: this.dateForm.date + ' 00:00:00',
  378. }).then(res => {
  379. this.isShowEditDateDialog = false;
  380. this.getList();
  381. this.$successMsg('修改成功');
  382. })
  383. },
  384. }
  385. }
  386. </script>
  387. <style lang="scss" scoped>
  388. </style>