index.vue 6.4 KB

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