index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <el-card
  3. v-loading="loading"
  4. style="width: calc(100% - 24px); height: 100%; margin: 10px;padding: 10px;"
  5. :body-style="{ padding: 0 }"
  6. >
  7. <AddChangeOrders
  8. ref="addChangeOrders"
  9. :size="size"
  10. :dict="dict"
  11. :add-type="optionType"
  12. @success="useReset"
  13. ></AddChangeOrders>
  14. <SeeChangeOrders
  15. ref="seeChangeOrders"
  16. :size="size"
  17. :dict="dict"
  18. @success="useReset"
  19. ></SeeChangeOrders>
  20. <div>
  21. <el-super-search
  22. v-model="params"
  23. :size="size"
  24. :dict="dict"
  25. :columns="SearchColumns"
  26. @reset="useReset"
  27. @row-dblclick="useSee"
  28. @submit="useQuery(params, page)"
  29. ></el-super-search>
  30. <el-row
  31. :gutter="10"
  32. class="mb10"
  33. type="flex"
  34. justify="end"
  35. style="margin-top: 20px;"
  36. >
  37. <el-col :span="1.5">
  38. <el-button type="primary" size="mini" @click="newAdd">新增</el-button>
  39. <!-- <BatchImport></BatchImport> -->
  40. </el-col>
  41. </el-row>
  42. <div style="height: 600px; display:flex;">
  43. <el-super-table
  44. v-model="tableList"
  45. :dict="dict"
  46. :columns="TableColumns"
  47. :size="size"
  48. pagination
  49. :page="page"
  50. @pagination="useQuery(params, page)"
  51. @row-dblclick="useSee"
  52. >
  53. <el-table-column fixed="right" label="操作" width="150" align="center">
  54. <template slot-scope="scope">
  55. <el-button type="text" size="small" @click.stop="useSee(scope.row)">查看</el-button>
  56. <el-button
  57. v-if="scope.row.status == '1'"
  58. type="text"
  59. size="mini"
  60. @click.stop="handleBack(scope.row)"
  61. >流程收回</el-button>
  62. <el-button
  63. v-if="scope.row.oaId && scope.row.oaId !=''"
  64. @click.stop="jumpFlow(scope.row)"
  65. type="text"
  66. :size="size"
  67. >流程跳转</el-button>
  68. <el-button @click.stop="handleEdit(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3" type="text" size="small">编辑</el-button>
  69. <el-button type="text" size="small" @click.stop="deleteRow(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3">删除</el-button>
  70. </template>
  71. </el-table-column>
  72. </el-super-table>
  73. </div>
  74. </div>
  75. </el-card>
  76. </template>
  77. <script>
  78. import { dicts } from "./dicts";
  79. import { getChangeList , deleteChangeList,toOA} from '@/api/changeApply/basic';
  80. // 流程收回通用接口
  81. import {oaBack} from '@/api/requisition/basic';
  82. import useColumns from './columns';
  83. export default {
  84. name: 'changeApply',
  85. dicts:[...dicts, 'oa_templete_id'],
  86. components: {
  87. AddChangeOrders:() => import('./add/index.vue'),
  88. SeeChangeOrders:() => import('./see/index.vue'),
  89. BatchImport:() => import('./batchImport/index.vue'),
  90. ElSuperTable: () => import("@/components/super-table/index.vue"),
  91. ElSuperSearch: () => import("@/components/super-search/index.vue"),
  92. },
  93. data(){
  94. const {TableColumns,SearchColumns} = useColumns();
  95. const params = this.$init.params(SearchColumns);
  96. return {
  97. loading:false,
  98. size:'mini',
  99. tableList: [],
  100. TableColumns:TableColumns,
  101. page: { pageNum: 1, pageSize: 50, total: 0 },
  102. params:params,
  103. SearchColumns:SearchColumns,
  104. optionType:'add',
  105. }
  106. },
  107. methods:{
  108. async jumpFlow (row){
  109. const {name} = this.$store.state.user;
  110. try {
  111. let {code,msg,oaUrl} = await toOA(name,row.oaId);
  112. if(code == 200){
  113. window.open(oaUrl)
  114. }
  115. } catch (error) {
  116. }finally{
  117. }
  118. },
  119. //流程收回
  120. async handleBack(row){
  121. console.log('row', row)
  122. console.log('this.dicts.type', this.dict)
  123. try {
  124. const { msg, code } = await oaBack({
  125. fdTemplateId: this.dict.type.oa_templete_id.find(item => {
  126. return item.label == "物料变更单"
  127. }).value,
  128. fdId: row.oaId,
  129. billCode: row.code,
  130. billMaker: row.createBy
  131. });
  132. if (code === 200) {
  133. this.$emit("success");
  134. this.$notify.success(msg);
  135. }
  136. } catch (err) {
  137. console.error(err);
  138. } finally {
  139. this.useQuery(this.params, this.page);
  140. }
  141. },
  142. useReset(){
  143. this.page.pageNum = 1;
  144. this.page.pageSize = 10;
  145. this.params = this.$init.params(this.SearchColumns);
  146. this.useQuery(this.params, this.page);
  147. },
  148. //
  149. openAddChangeOrders(row) {
  150. const {setVisible,fetchItem} = this.$refs.addChangeOrders;
  151. setVisible(true);
  152. row && fetchItem(row);
  153. },
  154. async newAdd(){
  155. this.optionType = 'add';
  156. await this.openAddChangeOrders();
  157. },
  158. async handleEdit(row){
  159. this.optionType = 'edit';
  160. await this.openAddChangeOrders(row);
  161. },
  162. async useQuery(params,page) {
  163. try {
  164. this.loading = true;
  165. let {code,rows,total} = await getChangeList({...params,...page});
  166. if (code === 200) {
  167. this.tableList = rows
  168. this.page.total = total;
  169. }
  170. } catch (error) {
  171. }finally{
  172. this.loading = false;
  173. }
  174. },
  175. async useSee(row){
  176. const {setVisible,fetchItem} = this.$refs.seeChangeOrders;
  177. await setVisible(true);
  178. await fetchItem(row);
  179. },
  180. deleteRow(row){
  181. this.$confirm('是否删除此条数据?', '提示', {
  182. confirmButtonText: '确定',
  183. cancelButtonText: '取消',
  184. type: 'warning'
  185. }).then(async() => {
  186. try {
  187. let {code,msg} = await deleteChangeList({id: row.id});
  188. if(code == 200){
  189. this.$notify.success({
  190. // title: '成功',
  191. message: msg,
  192. });
  193. await this.useQuery(this.params, this.page);
  194. }
  195. } catch (error) {}
  196. })
  197. },
  198. },
  199. created(){
  200. this.params.code = this.$route.query.billCode
  201. this.useQuery(this.params, this.page);
  202. },
  203. }
  204. </script>