index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="changeApply">
  3. <div class="applyList" v-if="isList">
  4. <el-row :gutter="10" class="mb10">
  5. <!-- <el-select size="small" v-model="textValue" placeholder="请选择">
  6. <el-option
  7. v-for="item in text"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value">
  11. </el-option>
  12. </el-select>
  13. <el-select size="small" v-model="ruleValue" placeholder="请选择">
  14. <el-option
  15. v-for="item in rule"
  16. :key="item.value"
  17. :label="item.label"
  18. :value="item.value">
  19. </el-option>
  20. </el-select> -->
  21. <el-col :span="1.5">
  22. <span style="font-size: 14px;margin-right: 5px;">物料编码</span>
  23. <el-input
  24. v-model="queryParams.materialCode"
  25. size="small"
  26. placeholder="请输入物料编码查询"
  27. clearable
  28. style="width: 240px"
  29. />
  30. </el-col>
  31. <el-col :span="1.5">
  32. <span style="font-size: 14px;margin-right: 5px;">物料名称</span>
  33. <el-input
  34. v-model="queryParams.materialName"
  35. size="small"
  36. placeholder="请输入物料名称查询"
  37. clearable
  38. style="width: 240px"
  39. />
  40. </el-col>
  41. <el-col :span="1.5">
  42. <span style="font-size: 14px;margin-right: 5px;">单据状态</span>
  43. <el-select
  44. v-model="queryParams.status"
  45. size="small"
  46. placeholder="请选择单据状态"
  47. clearable
  48. style="width: 240px">
  49. <el-option
  50. v-for="item in options"
  51. :key="item.value"
  52. :label="item.label"
  53. :value="item.value">
  54. </el-option>
  55. </el-select>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button type="primary" size="small" plain @click="getList(queryParams)">查询</el-button>
  59. </el-col>
  60. <!-- <el-col :span="1.5">
  61. <el-button type="primary" size="small" plain>高级查询</el-button>
  62. </el-col> -->
  63. <el-col :span="1.5">
  64. <el-button type="primary" size="small" plain @click="reset">重置</el-button>
  65. </el-col>
  66. </el-row>
  67. <el-row :gutter="10" class="mb10">
  68. <el-col :span="1.5">
  69. <el-button type="primary" size="small" plain @click="newAdd">新增</el-button>
  70. </el-col>
  71. <!-- <el-col :span="1.5">
  72. <el-button type="primary" size="small" plain>导入</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button type="primary" size="small" plain>导出</el-button>
  76. </el-col> -->
  77. <!-- <el-col :span="1.5">
  78. <el-button type="primary" size="small" plain>批量提交</el-button>
  79. </el-col>
  80. <el-col :span="1.5">
  81. <el-button type="primary" size="small" plain>批量删除</el-button>
  82. </el-col> -->
  83. </el-row>
  84. <el-card>
  85. <el-table
  86. :data="tableList"
  87. class="request-table"
  88. fit
  89. max-height="680"
  90. @selection-change="handleSelectionChange"
  91. >
  92. <!-- <el-table-column type="selection" width="55" /> -->
  93. <el-table-column label="序号" align="center" type="index" width="50" />
  94. <el-table-column label="申请组织" align="center" width="200" prop="orgId" />
  95. <el-table-column label="单据编码" align="center" width="200" prop="code" />
  96. <el-table-column label="申请时间" align="center" width="150" prop="createTime" />
  97. <el-table-column label="单据状态" align="center" prop="status" :formatter="statusJug" />
  98. <el-table-column label="物料编码" align="center" width="150" prop="materialCode" />
  99. <el-table-column label="物料名称" align="center" width="150" prop="materialName" />
  100. <!-- <el-table-column label="最后审批人" align="center" width="120" prop="approver" />
  101. <el-table-column label="最后审核时间" align="center" width="150" prop="approvalTime" /> -->
  102. <el-table-column label="创建人" align="center" prop="createByName" />
  103. <el-table-column label="创建时间" align="center" width="150" prop="createTime" />
  104. <el-table-column label="最后修改人" align="center" width="120" prop="updateByName" />
  105. <el-table-column label="最后修改时间" align="center" width="150" prop="updateTime" />
  106. <el-table-column
  107. fixed="right"
  108. label="操作"
  109. align="center"
  110. width="150"
  111. >
  112. <template slot-scope="scope">
  113. <el-button type="text" size="small" @click="check(scope.row)">查看</el-button>
  114. <el-button @click="edit(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3" type="text" size="small">编辑</el-button>
  115. <el-button type="text" size="small" @click="deleteRow(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3">删除</el-button>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <el-pagination
  120. @size-change="handleSizeChange"
  121. @current-change="handleCurrentChange"
  122. :page-sizes="[5, 10, 15, 20]"
  123. :page-size=queryParams.pageSize
  124. layout="total, sizes, prev, pager, next, jumper"
  125. :total="total"
  126. style="text-align: center;">
  127. </el-pagination>
  128. </el-card>
  129. </div>
  130. <component :is="isComponent" v-model="isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="getList" v-if="!isList"/>
  131. </div>
  132. </template>
  133. <script>
  134. import addApply from './add.vue';
  135. import { getChangeList , deleteChangeList} from '@/api/changeApply/basic'
  136. export default {
  137. name: 'changeApply',
  138. components: {
  139. addApply
  140. },
  141. data() {
  142. return{
  143. tableList: [],
  144. queryParams: {
  145. materialCode: '',
  146. materialName: '',
  147. status: '',
  148. pageNum: 1,
  149. pageSize: 10
  150. },
  151. options: [{
  152. value: 0, label: '未提交'
  153. },{
  154. value: 1, label: '审批中'
  155. },{
  156. value: 2, label: '已完成'
  157. },{
  158. value: 3, label: '已驳回'
  159. },],
  160. total:0,
  161. // isComponent
  162. isComponent:'addApply',
  163. isList: true,
  164. // 页面状态
  165. page: '',
  166. rowDetail: {},
  167. disable: false
  168. }
  169. },
  170. created() {
  171. },
  172. mounted() {
  173. this.getList(this.queryParams)
  174. },
  175. methods: {
  176. reset() {
  177. this.queryParams.materialCode = ''
  178. this.queryParams.materialName = ''
  179. this.queryParams.pageNum = 1
  180. this.queryParams.status = ''
  181. this.getList(this.queryParams)
  182. },
  183. newAdd() {
  184. this.isList = false
  185. this.isComponent = 'addApply'
  186. this.page = 'add'
  187. this.disable = false
  188. },
  189. getList(val) {
  190. console.log('val',val)
  191. getChangeList(val).then(res => {
  192. if (res.code === 200) {
  193. this.tableList = res.rows
  194. this.total = res.total
  195. }
  196. })
  197. },
  198. // 表格内状态栏判断值
  199. statusJug(row) {
  200. if (row.status === 0) {
  201. return '未提交'
  202. } else if (row.status === 1) {
  203. return '审批中'
  204. } else if (row.status === 2) {
  205. return '已完成'
  206. } else if (row.status === 3) {
  207. return '已驳回'
  208. }
  209. },
  210. //
  211. handleSelectionChange () {
  212. },
  213. check(row) {
  214. console.log('查看详情', row)
  215. this.isList = false
  216. this.isComponent = 'addApply'
  217. this.page = 'check'
  218. this.rowDetail = row
  219. this.disable = true
  220. },
  221. edit(row) {
  222. console.log('修改先加载详情', row)
  223. this.isList = false
  224. this.isComponent = 'addApply'
  225. this.page = 'edit'
  226. this.rowDetail = row
  227. this.disable = false
  228. },
  229. deleteRow(row) {
  230. this.$confirm('是否删除此条数据?', '提示', {
  231. confirmButtonText: '确定',
  232. cancelButtonText: '取消',
  233. type: 'warning'
  234. }).then(() => {
  235. deleteChangeList({id: row.id}).then(res => {
  236. if(res.code === 200) {
  237. this.$message({
  238. message: res.msg,
  239. type: 'success'
  240. });
  241. this.getList(this.queryParams)
  242. }
  243. })
  244. }).catch(() => {})
  245. },
  246. handleSizeChange(val) {
  247. console.log(`每页 ${val} 条`);
  248. this.queryParams.pageSize = val
  249. this.getList(this.queryParams)
  250. },
  251. handleCurrentChange(val) {
  252. console.log(`当前页: ${val}`);
  253. this.queryParams.pageNum = val
  254. this.getList(this.queryParams)
  255. }
  256. }
  257. }
  258. </script>
  259. <style scoped lang="scss">
  260. .changeApply {
  261. height: calc(100vh - 84px);
  262. padding: 12px;
  263. box-sizing: border-box;
  264. }
  265. </style>