index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="采购需求"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="需求单编码/需求单名称/产品名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  13. </view>
  14. <view class="wrapper">
  15. <u-list @scrolltolower="scrolltolower" class="listContent">
  16. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  17. <myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList">
  18. </myCard>
  19. </view>
  20. </u-list>
  21. </view>
  22. <view style='margin-top: 20vh;' v-if="tableList.length==0">
  23. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  24. </u-empty>
  25. </view>
  26. <view class="add" @click="add">
  27. <u-icon name="plus" color="#fff"></u-icon>
  28. </view>
  29. <u-toast ref="uToast"></u-toast>
  30. <u-modal @confirm="handleSubmit" ref="popup" type="center" :show="modalShow" @cancel="modalShow=false"
  31. :showCancelButton="true" :closeOnClickOverlay="true">
  32. <view class="popup-content">
  33. <form>
  34. <view class="form-item">
  35. <label class="form-label">*部门</label>
  36. <u--input placeholder="部门" @click.native="showPicker"
  37. v-model="addForm.planExecuteGroupName"></u--input>
  38. </view>
  39. <view class="form-item">
  40. <label class="form-label">*计划执行人</label>
  41. <uni-data-picker v-model="addForm.planExecuteUserId" placeholder="请选择" :localdata="userList"
  42. @change="industryOnchange">
  43. </uni-data-picker>
  44. </view>
  45. </form>
  46. </view>
  47. </u-modal>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. getTableList,
  53. deleteInformation
  54. } from '@/api/purchasingManage/purchaseNeedManage.js'
  55. import myCard from '../components/myCard.vue'
  56. import { reviewStatusEnum } from "@/enum/dict";
  57. import { auditSalesDemand } from '@/api/salesServiceManagement/demandList/index.js'
  58. export default {
  59. components: {
  60. myCard,
  61. },
  62. data() {
  63. return {
  64. tableList: [],
  65. searchVal: '',
  66. page: 1,
  67. size: 10,
  68. isEnd: false,
  69. modalShow: false,
  70. current: {},
  71. btnList: [{
  72. name: '详情',
  73. apiName: '',
  74. btnType: 'primary',
  75. type: '1',
  76. pageUrl: '/pages/purchasingManage/purchaseNeedManage/components/drawer',
  77. },
  78. {
  79. name: '修改',
  80. apiName: '',
  81. btnType: 'primary',
  82. type: '1',
  83. pageUrl: '/pages/purchasingManage/purchaseNeedManage/add',
  84. judge: [{
  85. authorities: '',
  86. }, {
  87. key: 'status',
  88. value: [0, 3],
  89. }],
  90. },
  91. {
  92. name: '提交',
  93. apiName: 'handleAudit',
  94. btnType: 'primary',
  95. type: '2',
  96. pageUrl: '',
  97. judge: [{
  98. authorities: '',
  99. }, {
  100. fn: (row) => {
  101. if (row?.afterSalesType == 3) {
  102. return (
  103. (row?.approvalResult == 0 || row?.approvalResult == 3) &&
  104. row?.demandStatus != 2
  105. );
  106. } else {
  107. return row?.demandStatus == 0;
  108. }
  109. },
  110. }],
  111. },
  112. {
  113. name: '删除',
  114. apiName: 'del',
  115. btnType: 'error',
  116. type: '2',
  117. pageUrl: '',
  118. judge: [{
  119. }, {
  120. key: 'status',
  121. value: [0, 3]
  122. }],
  123. }],
  124. columns: [
  125. [{
  126. label: '名称:',
  127. prop: 'requirementName',
  128. type: 'title',
  129. className: 'perce100',
  130. }],
  131. [{
  132. label: '编码:',
  133. prop: 'requirementCode'
  134. }, {
  135. label: '产品名称:',
  136. prop: 'productNames'
  137. }],
  138. [{
  139. label: '需求类型:',
  140. prop: 'sourceTypeName'
  141. }, {
  142. label: '需求部门:',
  143. prop: 'requireDeptName'
  144. }],
  145. [{
  146. label: '需求人:',
  147. prop: 'requireUserName'
  148. }, {
  149. label: '创建时间:',
  150. prop: 'createTime'
  151. }],
  152. [{
  153. label: '状态:',
  154. prop: 'status',
  155. formatter: (row) => {
  156. return reviewStatusEnum.find(item => item.value === row.status)?.label || '';
  157. }
  158. }],
  159. [{
  160. label: '操作:',
  161. prop: 'action',
  162. type: 'action',
  163. className: 'perce100',
  164. }],
  165. ]
  166. }
  167. },
  168. computed: {
  169. },
  170. onShow() {
  171. this.isEnd = false
  172. this.page = 1
  173. this.getList()
  174. },
  175. methods: {
  176. doSearch() {
  177. this.isEnd = false
  178. this.page = 1
  179. this.getList()
  180. },
  181. //获取列表信息
  182. getList() {
  183. if (this.isEnd) {
  184. return
  185. }
  186. uni.showLoading({
  187. title: '加载中'
  188. })
  189. let data = {
  190. pageNum: this.page,
  191. size: this.size,
  192. type: 1,
  193. searchName: this.searchVal
  194. }
  195. getTableList(data).then(res => {
  196. if (this.page === 1) {
  197. this.tableList = res.list
  198. } else {
  199. this.tableList.push(...res.list)
  200. }
  201. this.page += 1
  202. this.isEnd = this.tableList.length >= res.count
  203. }).then(() => {
  204. uni.hideLoading()
  205. })
  206. },
  207. handleAudit(row) {
  208. this.current = row
  209. if(row.afterSalesType==3){
  210. this.listSubmit()
  211. }else{
  212. this.modalShow = true
  213. }
  214. console.log(this.modalShow, 'dsds')
  215. },
  216. handleSubmit() {
  217. auditSalesDemand({
  218. ...this.addForm,
  219. submitSource: 3,
  220. id: this.current.id
  221. })
  222. .then((res) => {
  223. if (res) {
  224. this.modalShow = false
  225. this.$refs.uToast.show({
  226. type: "success",
  227. message: "操作成功",
  228. })
  229. this.doSearch();
  230. }
  231. })
  232. .catch((err) => {
  233. this.modalShow = false
  234. });
  235. },
  236. add() {
  237. uni.navigateTo({
  238. url: '/pages/purchasingManage/purchaseNeedManage/add'
  239. })
  240. },
  241. view() {
  242. },
  243. del(item) {
  244. uni.showModal({
  245. title: '提示',
  246. content: '确定删除吗?',
  247. success: (res) => {
  248. if (res.confirm) {
  249. deleteInformation([item.id]).then(res => {
  250. this.isEnd = false
  251. this.page = 1
  252. this.$refs.uToast.show({
  253. type: "success",
  254. message: "操作成功",
  255. })
  256. this.getList(this.where)
  257. }).catch(() => {
  258. // this.$refs.uToast.show({
  259. // type: "error",
  260. // message: "操作失败",
  261. // })
  262. })
  263. }
  264. }
  265. })
  266. },
  267. scrolltolower() {
  268. if (this.isEnd) {
  269. return
  270. }
  271. this.getList();
  272. },
  273. }
  274. }
  275. </script>
  276. <style lang="scss" scoped>
  277. .add {
  278. width: 96rpx;
  279. height: 96rpx;
  280. border-radius: 48rpx;
  281. background: #3c9cff;
  282. position: fixed;
  283. bottom: 100rpx;
  284. right: 24rpx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. }
  289. .top-wrapper {
  290. background-color: #fff;
  291. display: flex;
  292. width: 750rpx;
  293. height: 88rpx;
  294. padding: 16rpx 32rpx;
  295. align-items: center;
  296. gap: 16rpx;
  297. /deep/.uni-section {
  298. margin-top: 0px;
  299. }
  300. /deep/.uni-section-header {
  301. padding: 0px;
  302. }
  303. .search_btn {
  304. width: 120rpx;
  305. height: 70rpx;
  306. line-height: 70rpx;
  307. padding: 0 24rpx;
  308. background: $theme-color;
  309. font-size: 32rpx;
  310. color: #fff;
  311. margin: 0;
  312. margin-left: 26rpx;
  313. }
  314. .menu_icon {
  315. width: 44rpx;
  316. height: 44rpx;
  317. margin-left: 14rpx;
  318. }
  319. }
  320. </style>