index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <view>
  3. <view class="bg-white padding">
  4. <view class="flex justify-between ">
  5. <uni-easyinput prefixIcon="bottom" suffixIcon="search" v-model="queryfrom.styleNum" placeholder="搜索工厂款号"
  6. @iconClick="iconClick" @confirm="getData(1)">
  7. </uni-easyinput>
  8. <view style="padding: 4px;width: 50px;height: 40px;">
  9. <button @click="chooseFileClick" type="primary" size="mini" class="mini-btn"
  10. style="padding:0px;width: 100%;">导入</button>
  11. </view>
  12. </view>
  13. <view class="flex" v-if="searchShow">
  14. <view class="flex-sub padding-left-xs padding-top-xs">
  15. <uni-easyinput v-model="queryfrom.custName" placeholder="搜索客人名称" @confirm="getData(1)">
  16. </uni-easyinput>
  17. </view>
  18. <!-- <view class="flex-sub padding-left-xs padding-top-xs">
  19. <uni-easyinput v-model="queryfrom.styleNum" placeholder="搜索工厂款号">
  20. </uni-easyinput>
  21. </view> -->
  22. </view>
  23. <!-- <view class="flex" v-if="searchShow">
  24. <view class="flex-sub padding-left-xs padding-top-xs">
  25. <uni-easyinput v-model="queryfrom.custName" placeholder="搜索客人名称">
  26. </uni-easyinput>
  27. </view>
  28. <view class="flex-sub padding-left-xs padding-top-xs">
  29. <uni-easyinput v-model="queryfrom.color" placeholder="搜索颜色">
  30. </uni-easyinput>
  31. </view>
  32. </view> -->
  33. <view class="flex justify-between padding-top-sm" v-if="searchShow">
  34. <button class="mini-btn" type="default" size="mini" @click="searchShow = !searchShow">
  35. <text class="cuIcon-fold" style="margin-right: 5px;"></text>收回
  36. </button>
  37. <button class="mini-btn" type="primary" size="mini" @click="getData(1)">搜索</button>
  38. </view>
  39. </view>
  40. <view class="bg-white ">
  41. <uni-table ref="table" :loading="loading" border stripe="true" emptyText="暂无更多数据">
  42. <uni-tr>
  43. <uni-th v-for="(item,index) in column" :key="index" :width="item.width" :align="item.align"
  44. style="padding:0px" :fixed="item.fixed">
  45. <template v-if="item.label=='帮面材料'||item.label=='大底材料'||item.label=='包装材料'">
  46. <view style="display:inline-block;width: 100%;">
  47. <view style="border-bottom:1px solid #eee;">
  48. {{item.label}}
  49. </view>
  50. <view style="width: 100%;">开始日期</view>
  51. </view>
  52. </template>
  53. <template v-else-if="item.label=='冲裁'||item.label=='针车'||item.label=='成型'">
  54. <view style="display:inline-block;width: 100%;">
  55. <view style="border-bottom:1px solid #eee;">
  56. {{item.label}}
  57. </view>
  58. <view style="width: 100%;">
  59. <view style="width: 25%;display: inline-block;">加工类型</view>
  60. <view style="width: 37.5%;display: inline-block;">开始日期</view>
  61. <view style="width: 37.5%;display: inline-block;">结束日期</view>
  62. </view>
  63. </view>
  64. </template>
  65. <template v-else-if="item.label=='配套'">
  66. <view style="display:inline-block;width: 100%;">
  67. <view style="border-bottom:1px solid #eee;">
  68. {{item.label}}
  69. </view>
  70. <view style="width: 100%;">
  71. <span style="width: 50%;display: inline-block;">开始日期</span>
  72. <span style="width: 50%;display: inline-block;">结束日期</span>
  73. </view>
  74. </view>
  75. </template>
  76. <template v-else>{{item.label}}</template>
  77. </uni-th>
  78. </uni-tr>
  79. <uni-tr v-for="(item, index) in tableData" :key="index">
  80. <uni-td v-for="(items,indexs) in column" :key="indexs" :width="items.width" :align="items.align">
  81. <!-- endTime type -->
  82. <template v-if="items.label=='主图'">
  83. <image class="slot-image" :src="item[items.name]" mode="aspectFit"
  84. style="max-width:75px;max-height:35px;">
  85. </template>
  86. <template v-else-if="items.label=='业务备注'">
  87. <uni-tooltip :content="item[items.name]" placement="top" v-if="item[items.name]">点击查看</uni-tooltip>
  88. </template>
  89. <template v-else-if="items.label=='备注'">
  90. <uni-tooltip :content="item.sched.remark" placement="top" v-if="item.sched.remark">点击查看</uni-tooltip>
  91. </template>
  92. <template v-else-if="items.label=='帮面材料'||items.label=='大底材料'||items.label=='包装材料'">
  93. {{item[items.name+'startTime']||''}}
  94. </template>
  95. <template v-else-if="items.label=='确认样提供'">
  96. <uni-tooltip :content="formatDate(item.shoeFactory.sampleTime)" placement="top"
  97. v-if="item.shoeFactory.sampleTime">{{item.shoeFactory.sampleFlag?'是':'否'}}</uni-tooltip>
  98. </template>
  99. <template v-else-if="items.label=='色卡提供'">
  100. <uni-tooltip :content="formatDate(item.shoeFactory.colorCardTime)" placement="top"
  101. v-if="item.shoeFactory.colorCardTime">{{item.shoeFactory.colorCardFlag?'是':'否'}}</uni-tooltip>
  102. </template>
  103. <template v-else-if="items.label=='是否技转'">
  104. {{item.shoeFactory.skillTransferFlag?'是':item.shoeFactory.skillTransferFlag===false?'否' :''}}
  105. </template>
  106. <template v-else-if="items.label=='款式标记'">
  107. {{item[items.name]==0?'新款':'旧款'}}
  108. </template>
  109. <template v-else-if="items.label=='延期'">
  110. <span style="color: #F56C6C;">{{judgePostpone(item)}}</span>
  111. </template>
  112. <template v-else-if="items.label=='是否审核'">
  113. <template v-if="!item.sched">
  114. <uni-tag type="default" :inverted="true" text="暂无排程"></uni-tag>
  115. </template>
  116. <template v-else-if="item.sched && item.sched.audit">
  117. <uni-tag type="success" :inverted="true" text="已审"></uni-tag>
  118. </template>
  119. <template v-else-if="item.sched && !item.sched.audit">
  120. <uni-tag type="warning" :inverted="true" text="待审"></uni-tag>
  121. </template>
  122. </template>
  123. <!-- 配套 -->
  124. <template v-else-if="items.label=='冲裁'||items.label=='针车'||items.label=='成型'">
  125. <view style="display:inline-block;height: 100%;width: 100%;">
  126. <view style="width: 25%;display: inline-block;">{{item[items.name+'type']||' '}}</view>
  127. <view style="width: 37.5%;display: inline-block;">{{item[items.name+'startTime']||' '}}</view>
  128. <view style="width: 37.5%;display: inline-block;">{{item[items.name+'endTime']||' '}}</view>
  129. </view>
  130. </template>
  131. <template v-else-if="items.label=='配套'">
  132. <view style="display:inline-block;height: 100%;width: 100%;">
  133. <view style="width: 50%;display: inline-block;">{{item[items.name+'startTime']||' '}}</view>
  134. <view style="width: 50%;display: inline-block;">{{item[items.name+'endTime']||' '}}</view>
  135. </view>
  136. </template>
  137. <template v-else>{{item[items.name]||''}}</template>
  138. </uni-td>
  139. </uni-tr>
  140. </uni-table>
  141. <!-- <zb-table :show-header="true" :columns="column" :stripe="true" :fit="false" @cellClick="cellClick"
  142. :summary-method="getSummaries" @toggleRowSelection="toggleRowSelection" @toggleAllSelection="toggleAllSelection"
  143. :border="true" @edit="buttonEdit" @dele="dele" :data="tableData"></zb-table> -->
  144. </view>
  145. <view style="height: 40px;">
  146. </view>
  147. <view class="uni-pagination-box down-button"><uni-pagination show-icon :page-size="queryfrom.pageSize"
  148. :current="queryfrom.pageNum" :total="total" @change="change" /></view>
  149. </view>
  150. </template>
  151. <script>
  152. import { listManuOrder, } from '@/api/order/schedule.js'
  153. import { formatDate, formatDateMinute } from '@/utils/date.js'
  154. import config from '@/config'
  155. import { toast, showConfirm, tansParams } from '@/utils/common'
  156. import { getToken } from '@/utils/auth'
  157. import jweixin from 'weixin-js-sdk'
  158. const baseUrl = config.baseUrl
  159. export default {
  160. data() {
  161. return {
  162. getDataApi: listManuOrder,
  163. tableData: [],
  164. // 数据总量
  165. total: 0,
  166. loading: false,
  167. queryfrom: {
  168. pageSize: 15,
  169. // 每页数据量
  170. pageNum: 1,
  171. // 当前页
  172. facId: '',
  173. styleNum: '',
  174. color: '',
  175. version: ''
  176. },
  177. procOption: [],
  178. searchShow: false,
  179. picker: [],
  180. column: [
  181. // { type: 'selection', fixed: true, width: 50 },
  182. // { name: 'id', type: 'index', label: '序号', width: 53, align: 'center' },
  183. { name: 'picture', label: '主图', width: 75, align: 'center' },
  184. { name: 'styleNum', label: '工厂款号', width: 90, align: 'center' },
  185. { name: 'version', label: '版本号', width: 55, align: 'center' },
  186. { name: 'color', label: '中文颜色', width: 70, align: 'center' },
  187. { name: 'custNum', label: '客户款号', width: 110, align: 'center' },
  188. { name: 'qtyTotal', label: '订单数量', width: 65, align: 'center' },
  189. { name: 'id', label: 'ID', width: 30, align: 'center' },
  190. { name: 'entryDate', label: '下单日期', width: 90, sorter: true, emptyString: '', align: 'center' },
  191. { name: 'factoryName', label: '生产工厂', width: 60, align: 'center', emptyString: '' },
  192. { name: 'facHandDate', label: '工厂交期', width: 90, sorter: true, emptyString: '', align: 'center' },
  193. { name: 'custName', label: '客户名称', fixed: false, width: 65, emptyString: '--', align: 'center' },
  194. { name: 'manuNum', label: '指令号', sorter: false, align: 'center', width: 100, },
  195. { name: 'styleFlag', label: '款式标记', width: 60, align: 'center', filters: { 0: '旧款', 1: '新款' } },
  196. { name: 'shoeLastNum', label: '楦头编号', width: 110, align: 'center', emptyString: '' },
  197. { name: 'outsoleModelNum', label: '大底编号', width: 95, align: 'center', emptyString: '' },
  198. { name: 'outsoleModelFac', label: '大底厂家', width: 60, align: 'center', emptyString: '' },
  199. { name: 'remark', label: '业务备注', width: 60, align: 'center', emptyString: '' },
  200. { name: '确认样提供', label: '确认样提供', width: 75, align: 'center' },
  201. { name: '色卡提供', label: '色卡提供', width: 70, align: 'center' },
  202. { name: '是否技转', label: '是否技转', width: 60, align: 'center' },
  203. { name: '帮面', label: '帮面材料', width: 90, align: 'center', },
  204. { name: '大底', label: '大底材料', width: 90, align: 'center' },
  205. { name: '包装', label: '包装材料', width: 90, align: 'center' },
  206. { name: '冲裁', label: '冲裁', width: 240, align: 'center' },
  207. { name: '配套', label: '配套', width: 180, align: 'center' },
  208. { name: '针车', label: '针车', width: 240, align: 'center' },
  209. { name: '成型', label: '成型', width: 240, align: 'center' },
  210. { name: 'remark', label: '备注', width: 60, align: 'center' },
  211. { name: 'postpone', label: '延期', width: 60, align: 'center' },
  212. { name: 'audit', label: '是否审核', width: 60, align: 'center' },
  213. // {
  214. // name: 'operation',
  215. // type: 'operation',
  216. // label: '操作',
  217. // renders: [{
  218. // name: '编辑',
  219. // func: 'edit' // func 代表子元素点击的事件 父元素接收的事件 父元素 @edit
  220. // },
  221. // {
  222. // name: '删除',
  223. // type: 'warn',
  224. // func: 'dele'
  225. // },
  226. // ]
  227. // },
  228. ],
  229. }
  230. },
  231. onLoad() {
  232. this.picker = this.$store.state.user.factoryOption
  233. this.procOption = this.$store.state.user.procOption
  234. console.log(this.procOption)
  235. this.selectedIndexs = []
  236. this.getData(1)
  237. },
  238. methods: {
  239. // 微信聊天选择文件
  240. chooseFileClick() {
  241. wx.chooseMessageFile({
  242. count: 10,
  243. type: 'all', //all,video,image,file
  244. success: res => {
  245. // /manu/sched/imp
  246. let header = { 'Authorization': 'Bearer ' + getToken() }
  247. uni.uploadFile({
  248. url: baseUrl + '/manu/sched/imp', //仅为示例,非真实的接口地址
  249. filePath: res.tempFiles[0].path,
  250. header: header,
  251. name: 'file',
  252. formData: {},
  253. complete: function(uploadFileRes) {
  254. let result = JSON.parse(uploadFileRes.data)
  255. console.log(result)
  256. if (result.code === 500) {
  257. toast(result.msg)
  258. }
  259. if (result.code === 200) {
  260. toast('上传成功')
  261. }
  262. }
  263. })
  264. },
  265. })
  266. },
  267. cellClick(row, index, column) {
  268. if (column.name === 'remark' || column.name === '')
  269. uni.showToast({
  270. icon: 'none',
  271. duration: 3000,
  272. title: '点击' + column.label
  273. })
  274. console.log('点击单元格', row, index, column)
  275. },
  276. rowClick(row, index) {
  277. uni.showToast({
  278. icon: 'none',
  279. duration: 3000,
  280. title: '单击某行'
  281. })
  282. console.log('单击某行', row, index)
  283. },
  284. PickerChange(e) {
  285. console.log('e', e.detail)
  286. this.queryfrom.facId = e.detail.value[0].value
  287. },
  288. iconClick(type) {
  289. if (type === 'prefix') {
  290. this.searchShow = !this.searchShow
  291. } else { this.getData(1) }
  292. // uni.showToast({
  293. // title: `点击了${type==='prefix'?'左侧':'右侧'}的图标`,
  294. // icon: 'none'
  295. // })
  296. },
  297. // 分页触发
  298. change(e) {
  299. // this.$refs.table.clearSelection()
  300. this.selectedIndexs.length = 0
  301. console.log(e.current)
  302. this.getData(e.current)
  303. },
  304. formatDate(time) {
  305. return formatDate(time)
  306. },
  307. judgePostpone(item) {
  308. return formatDate(item.facHandDate) < (item['成型endTime'] ? formatDate(item['成型endTime']) : formatDate(
  309. new Date())) ? '延期' : ''
  310. },
  311. // 获取数据
  312. getData(pageCurrent, value = '') {
  313. // this.loading = true;
  314. // this.pageCurrent = pageCurrent
  315. // this.request({
  316. // pageSize: this.pageSize,
  317. // pageCurrent: pageCurrent,
  318. // value: value,
  319. // success: res => {
  320. // // console.log('data', res);
  321. // this.tableData = res.data
  322. // this.total = res.total
  323. // this.loading = false
  324. // }
  325. // })
  326. this.queryfrom.pageNum = pageCurrent
  327. // uni.showLoading({ title: '加载中' })
  328. this.getDataApi(this.queryfrom).then(res => {
  329. uni.hideLoading()
  330. this.loading = false
  331. console.log(res.rows)
  332. if (res.code === 200) {
  333. this.tableData = res.rows.map(item => {
  334. item.picture = item.shoeStyle.mainPicture ? item.shoeStyle.mainPicture.filePath : ''
  335. item.entryDate = formatDate(item.entryDate)
  336. item.factoryName = item.factory.name
  337. item.facHandDate = formatDate(item.facHandDate)
  338. item.custName = item.custName
  339. item.styleFlag = item.shoeStyle.styleFlag
  340. item.styleNum = item.shoeStyle.styleNum
  341. item.version = item.shoeStyle.version
  342. item.color = item.shoeStyle.color
  343. item.shoeLastNum = item.shoeStyle.shoeLastNum
  344. item.outsoleModelNum = item.shoeStyle.outsoleModelNum
  345. item.outsoleModelFac = item.shoeStyle.outsoleModelFac
  346. // item.shoeremark = item.shoeStyle.remark
  347. item.sched && item.sched.detList.map(detItem => {
  348. this.procOption.map(procItem => {
  349. if (detItem.procId === procItem.id) {
  350. item[procItem.procName + 'startTime'] = formatDate(detItem.startTime)
  351. item[procItem.procName + 'endTime'] = formatDate(detItem.endTime)
  352. item[procItem.procName + 'type'] = detItem.procType
  353. }
  354. })
  355. })
  356. // console.log(item)
  357. return item
  358. })
  359. this.total = res.total
  360. console.log(this.tableData)
  361. }
  362. }).catch(err => {})
  363. },
  364. }
  365. }
  366. </script>
  367. <style>
  368. .table-thead {
  369. background-color: #FFFAF2 !important;
  370. position: sticky;
  371. left: 0;
  372. top: 0;
  373. z-index: 20;
  374. }
  375. /deep/ .uni-table-tr {
  376. overflow: visible;
  377. background-color: #fff;
  378. }
  379. //固定表头第一列
  380. /deep/ .uni-table-tr .uni-table-th:first-child {
  381. position: sticky;
  382. left: 0;
  383. top: 0;
  384. background-color: #fff;
  385. z-index: 10;
  386. }
  387. //固定表头第一列(需计算第一列宽度,我这里是200rpx)
  388. /deep/ .uni-table-tr .uni-table-th:nth-child(2) {
  389. position: sticky;
  390. left: 75px;
  391. top: 0;
  392. background-color: #fff;
  393. z-index: 10;
  394. }
  395. //冻结thead第一列
  396. /deep/ .uni-table-tr .uni-table-td:first-child {
  397. position: sticky;
  398. left: 0;
  399. top: 0;
  400. background-color: #fff;
  401. z-index: 10;
  402. }
  403. //冻结thead第二列(需计算第一列宽度)
  404. /deep/ .uni-table-tr .uni-table-td:nth-child(2) {
  405. position: sticky;
  406. left: 75px;
  407. top: 0;
  408. background-color: #fff;
  409. z-index: 10;
  410. }
  411. .uni-group {
  412. display: flex;
  413. align-items: center;
  414. }
  415. </style>