PurchaseForm.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  1. <template>
  2. <view>
  3. <cu-custom :backUrl="'/pages/index/index'" :isBack="true" bgColor="bg-gradual-blue">
  4. <block slot="content">采购申请</block>
  5. </cu-custom>
  6. <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules"
  7. ref="inputForm" v-if="!nodeFlag">
  8. <u-form-item label="采购编号" borderBottom prop="purchaseNo">
  9. <u--input placeholder='自动生成' v-model="inputForm.purchaseNo" disabled></u--input>
  10. </u-form-item>
  11. <u-form-item label="采购名称" borderBottom prop="purchaseSketch" :required="true">
  12. <u--input placeholder='请填写采购名称' v-model="inputForm.purchaseSketch"></u--input>
  13. </u-form-item>
  14. <u-form-item label="经办人" borderBottom prop="handledBy">
  15. <u--input placeholder='' v-model="inputForm.handledBy" disabled></u--input>
  16. </u-form-item>
  17. <u-form-item label="经办人部门" borderBottom prop="handledByOfficeName">
  18. <u--input placeholder='' v-model="inputForm.handledByOfficeName" disabled></u--input>
  19. </u-form-item>
  20. <u-form-item label="采购申请时间" borderBottom prop="purchaseDate" :required="true">
  21. <el-date-picker v-model="inputForm.purchaseDate" type="date" placeholder="请选择采购申请时间" style="width:100%"
  22. size="default" placement="bottom-start" clearable>
  23. </el-date-picker>
  24. </u-form-item>
  25. <u-form-item label="采购方式" borderBottom prop="purchaseMode" :required="true">
  26. <jp-picker placeholder='请选择采购方式' v-model="inputForm.purchaseMode" rangeKey="label" rangeValue="value"
  27. :range="[
  28. { label: '办公室采购', value: '1' },
  29. { label: '自行采购', value: '2' },
  30. ]"></jp-picker>
  31. </u-form-item>
  32. <u-form-item label="备注" borderBottom prop="remarks">
  33. <u--textarea placeholder='请填写备注信息' :rows="5" :maxlength="500" v-model="inputForm.remarks"></u--textarea>
  34. </u-form-item>
  35. <el-row :gutter="15" :key="index_experience" v-for="(item, index_experience) in this.inputForm.detailInfos">
  36. <el-col :span="24">
  37. <u-form-item label="">
  38. <el-divider content-position="left"> 采购详情 {{ index_experience + 1 }}</el-divider>
  39. </u-form-item>
  40. </el-col>
  41. <el-col :span="24">
  42. <u-form-item label="采购人" :prop="'detailInfos[' + index_experience + '].purchaserAgent'"
  43. :required="true" :rules="[
  44. ]">
  45. <u--input v-model="inputForm.detailInfos[index_experience].purchaserAgent" placeholder="请选择采购人"
  46. @focus="openUserPullForm(index_experience)" clearable></u--input>
  47. </u-form-item>
  48. <u-form-item label="采购人部门" :prop="'detailInfos[' + index_experience + '].procurementOffice'"
  49. :required="true" :rules="[
  50. ]">
  51. <u--input v-model="inputForm.detailInfos[index_experience].procurementOffice" placeholder=""
  52. clearable></u--input>
  53. </u-form-item>
  54. <u-form-item label="采购类型" :prop="'detailInfos[' + index_experience + '].procurementType'"
  55. :required="true" :rules="[
  56. ]">
  57. <u--input v-model="inputForm.detailInfos[index_experience].procurementType"
  58. placeholder="请选择采购类型" @focus="showPicker(index_experience)" clearable></u--input>
  59. </u-form-item>
  60. <goods-selector :index_experience="index_experience" :inputForm="inputForm"
  61. @selected="handleGoodsSelected"></goods-selector>
  62. <!--<u-form-item label="商品名称" :prop="'detailInfos[' + index_experience + '].tradeName'"
  63. :rules="[
  64. ]">
  65. <u--input v-model="inputForm.detailInfos[index_experience].tradeName" placeholder="请选择物品名称" clearable></u--input>
  66. </u-form-item>-->
  67. <u-form-item label="商品单价(元)" :prop="'detailInfos[' + index_experience + '].tradePrice'" :rules="[
  68. ]">
  69. <u--input @blur="onInputCode(index_experience, $event, 'tradePrice')"
  70. v-model="inputForm.detailInfos[index_experience].tradePrice" placeholder="请输入商品单价(元)"
  71. clearable></u--input>
  72. </u-form-item>
  73. <u-form-item label="商品数量" :prop="'detailInfos[' + index_experience + '].tradeNumber'" :rules="[
  74. ]">
  75. <u--input @blur="onInputCode(index_experience, $event, 'tradeNumber')"
  76. v-model="inputForm.detailInfos[index_experience].tradeNumber" placeholder="请输入商品数量"
  77. clearable></u--input>
  78. </u-form-item>
  79. <u-form-item label="商品总价" :prop="'detailInfos[' + index_experience + '].priceSum'" :rules="[
  80. ]">
  81. <u--input v-model="inputForm.detailInfos[index_experience].priceSum" placeholder="请输入商品总价"
  82. :readonly="true" clearable></u--input>
  83. </u-form-item>
  84. <u-form-item label="品牌" :prop="'detailInfos[' + index_experience + '].brand'">
  85. <u--input v-model="inputForm.detailInfos[index_experience].brand" disabled></u--input>
  86. </u-form-item>
  87. <u-form-item label="规格" :prop="'detailInfos[' + index_experience + '].specification'">
  88. <u--input v-model="inputForm.detailInfos[index_experience].specification" disabled></u--input>
  89. </u-form-item>
  90. <u-form-item label="单位" :prop="'detailInfos[' + index_experience + '].company'" :rules="[
  91. ]">
  92. <u--input v-model="inputForm.detailInfos[index_experience].company" placeholder="请输入单位"
  93. disabled></u--input>
  94. </u-form-item>
  95. <u-form-item label="备注" :prop="'detailInfos[' + index_experience + '].remarks'" :rules="[
  96. ]">
  97. <u--input v-model="inputForm.detailInfos[index_experience].remarks" placeholder="请输入备注"
  98. clearable></u--input>
  99. </u-form-item>
  100. <u-form-item label="文件上传" v-if="false">
  101. <!-- <el-upload class="upload-demo"
  102. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  103. :on-remove="(file, fileList) => handleRemove(file, fileList, index_experience, 'detail')"
  104. :file-list="inputForm.detailInfos[index_experience].fileInfoLost"
  105. :on-success="(response, file, fileList) => handleUploadSuccess(response, file, fileList, index_experience, 'detail')"
  106. :limit="3">
  107. <el-button size="small" type="primary">点击上传</el-button>
  108. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  109. <template slot="file" slot-scope="{ file }"
  110. v-if="shouldShowFile(file, index_experience, 'detail') || testFlag">
  111. <span @click="handleFileClick(file)">{{ file.name }}</span>
  112. <el-button type="text" icon="el-icon-close"
  113. @click="handleDelete(file, index_experience, 'detail')">✕</el-button>
  114. </template>
  115. </el-upload> -->
  116. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  117. @onRemove="(file, fileList, fileIndex) => handleRemove(file, fileList, index_experience, fileIndex, 'detail')"
  118. @onSuccess="(file, fileList) => handleUploadSuccess(file, fileList, index_experience, 'detail')"
  119. :fileList="inputForm.detailInfos[index_experience].fileInfoLost" :limit="3"
  120. :isDelete="nodeFlag" :isUpload="nodeFlag">
  121. </UploadComponent>
  122. </u-form-item>
  123. </el-col>
  124. <el-col :span="24" style="text-align: center">
  125. <u-form-item label="">
  126. <el-button style="width: 100%" type="danger" @click="removeRow(index_experience)" plain>删除采购详情
  127. {{ index_experience + 1 }}</el-button>
  128. </u-form-item>
  129. </el-col>
  130. </el-row>
  131. <u-form-item label="">
  132. <el-button style="width: 100%" type="primary" @click="addRow()" plain>新增采购详情</el-button>
  133. </u-form-item>
  134. <u-form-item label="附件" v-if="false">
  135. <!-- <el-upload class="upload-demo"
  136. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  137. :on-remove="(file, fileList) => handleRemove(file, fileList, '', '')" :file-list="inputForm.files"
  138. :on-success="(response, file, fileList) => handleUploadSuccess(response, file, fileList, '', '')"
  139. :limit="3">
  140. <el-button size="small" type="primary">点击上传</el-button>
  141. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  142. <template slot="file" slot-scope="{ file }" v-if="shouldShowFile(file) || testFlag">
  143. <span @click="handleFileClick(file)">{{ file.name }}</span>
  144. <el-button type="text" icon="el-icon-close" @click="handleDelete(file)">✕</el-button>
  145. </template>
  146. </el-upload> -->
  147. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  148. @onRemove="(file, fileList, fileIndex) => handleRemove(file, fileList, fileIndex, '')"
  149. @onSuccess="(file, fileList) => handleUploadSuccess(file, fileList, '', '')"
  150. :fileList="inputForm.files" :limit="3" :isDelete="nodeFlag" :isUpload="nodeFlag">
  151. </UploadComponent>
  152. </u-form-item>
  153. </u--form>
  154. <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules"
  155. ref="inputForm" v-else-if="nodeFlag">
  156. <u-form-item label="采购编号" borderBottom prop="purchaseNo">
  157. <u--input placeholder='自动生成' v-model="inputForm.purchaseNo" disabled></u--input>
  158. </u-form-item>
  159. <u-form-item label="采购名称" borderBottom prop="purchaseSketch" :required="true">
  160. <u--input placeholder='请填写采购名称' disabled v-model="inputForm.purchaseSketch"></u--input>
  161. </u-form-item>
  162. <u-form-item label="经办人" borderBottom prop="handledBy">
  163. <u--input placeholder='' v-model="inputForm.handledBy" disabled></u--input>
  164. </u-form-item>
  165. <u-form-item label="经办人部门" borderBottom prop="handledByOfficeName">
  166. <u--input placeholder='' v-model="inputForm.handledByOfficeName" disabled></u--input>
  167. </u-form-item>
  168. <u-form-item label="采购申请时间" borderBottom prop="purchaseDate" :required="true">
  169. <el-date-picker :disabled="true" v-model="inputForm.purchaseDate" type="date" placeholder="请选择采购申请时间"
  170. style="width:100%" size="default" placement="bottom-start" clearable>
  171. </el-date-picker>
  172. </u-form-item>
  173. <u-form-item label="采购方式" borderBottom prop="purchaseMode" :required="true">
  174. <jp-picker placeholder='请选择采购方式' v-model="inputForm.purchaseMode" :disabled="true" rangeKey="label"
  175. rangeValue="value" :range="[
  176. { label: '办公室采购', value: '1' },
  177. { label: '自行采购', value: '2' },
  178. ]"></jp-picker>
  179. </u-form-item>
  180. <u-form-item label="备注" borderBottom prop="remarks">
  181. <u--textarea placeholder='请填写备注信息' :disabled="true" :rows="5" :maxlength="500"
  182. v-model="inputForm.remarks"></u--textarea>
  183. </u-form-item>
  184. <el-row :gutter="15" :key="index_experience" v-for="(item, index_experience) in this.inputForm.detailInfos">
  185. <el-col :span="24">
  186. <u-form-item label="">
  187. <el-divider content-position="left"> 采购详情 {{ index_experience + 1 }}</el-divider>
  188. </u-form-item>
  189. </el-col>
  190. <el-col :span="24">
  191. <u-form-item label="采购人" :prop="'detailInfos[' + index_experience + '].purchaserAgent'"
  192. :required="true" :rules="[
  193. ]">
  194. <el-input v-model="inputForm.detailInfos[index_experience].purchaserAgent" :disabled="true"
  195. placeholder="请选择采购人" @focus="openUserPullForm(index_experience)" clearable></el-input>
  196. </u-form-item>
  197. <u-form-item label="采购人部门" :prop="'detailInfos[' + index_experience + '].procurementOffice'"
  198. :required="true" :rules="[
  199. ]">
  200. <el-input v-model="inputForm.detailInfos[index_experience].procurementOffice" :disabled="true"
  201. placeholder="" clearable></el-input>
  202. </u-form-item>
  203. <u-form-item label="采购类型" :prop="'detailInfos[' + index_experience + '].procurementType'"
  204. :required="true" :rules="[
  205. ]">
  206. <el-input v-model="inputForm.detailInfos[index_experience].procurementType" :disabled="true"
  207. placeholder="请选择采购类型" @focus="showPicker(index_experience)" clearable></el-input>
  208. </u-form-item>
  209. <goods-selector :index_experience="index_experience" :disabled="true" :inputForm="inputForm"
  210. @selected="handleGoodsSelected"></goods-selector>
  211. <!-- <u-form-item label="商品名称" :prop="'detailInfos[' + index_experience + '].tradeName'" -->
  212. <!-- :rules="[-->
  213. <!-- ]">-->
  214. <!-- <el-input v-model="inputForm.detailInfos[index_experience].tradeName" placeholder="请选择物品名称" @focus="showGoods(index_experience)" clearable></el-input>-->
  215. <!-- </u-form-item>-->
  216. <u-form-item label="商品单价(元)" :prop="'detailInfos[' + index_experience + '].tradePrice'" :rules="[
  217. ]">
  218. <el-input @change="changeValue" :disabled="true"
  219. v-model="inputForm.detailInfos[index_experience].tradePrice" placeholder="请输入商品单价(元)"
  220. clearable></el-input>
  221. </u-form-item>
  222. <u-form-item label="商品数量" :prop="'detailInfos[' + index_experience + '].tradeNumber'" :rules="[
  223. ]">
  224. <el-input @change="changeValue" v-model="inputForm.detailInfos[index_experience].tradeNumber"
  225. :disabled="true" placeholder="请输入商品数量" clearable></el-input>
  226. </u-form-item>
  227. <u-form-item label="商品总价" :prop="'detailInfos[' + index_experience + '].priceSum'" :rules="[
  228. ]">
  229. <el-input v-model="inputForm.detailInfos[index_experience].priceSum" :disabled="true"
  230. placeholder="请输入商品总价" clearable></el-input>
  231. </u-form-item>
  232. <u-form-item label="品牌" :prop="'detailInfos[' + index_experience + '].brand'">
  233. <el-input v-model="inputForm.detailInfos[index_experience].brand" :disabled="true"></el-input>
  234. </u-form-item>
  235. <u-form-item label="规格" :prop="'detailInfos[' + index_experience + '].specification'">
  236. <el-input v-model="inputForm.detailInfos[index_experience].specification" :disabled="true"></el-input>
  237. </u-form-item>
  238. <u-form-item label="单位" :prop="'detailInfos[' + index_experience + '].company'" :rules="[
  239. ]">
  240. <el-input v-model="inputForm.detailInfos[index_experience].company" :disabled="true"
  241. placeholder="请输入单位" clearable></el-input>
  242. </u-form-item>
  243. <u-form-item label="备注" :prop="'detailInfos[' + index_experience + '].remarks'" :rules="[
  244. ]">
  245. <el-input v-model="inputForm.detailInfos[index_experience].remarks" :disabled="true"
  246. placeholder="请输入备注" clearable></el-input>
  247. </u-form-item>
  248. <u-form-item label="文件上传" v-if="false">
  249. <!-- <el-upload :disabled="true" class="upload-demo"
  250. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  251. :on-remove="(file, fileList) => handleRemove(file, fileList, index_experience, 'detail')"
  252. :file-list="inputForm.detailInfos[index_experience].fileInfoLost"
  253. :on-success="(response, file, fileList) => handleUploadSuccess( file, fileList, index_experience, 'detail')"
  254. :limit="3">
  255. <el-button size="small" :disabled="true" type="primary">点击上传</el-button>
  256. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  257. <template slot="file" slot-scope="{ file }"
  258. v-if="shouldShowFile(file, index_experience, 'detail') || testFlag">
  259. <span @click="handleFileClick(file)">{{ file.name }}</span>
  260. <el-button type="text" icon="el-icon-close"
  261. @click="handleDelete(file, index_experience, 'detail')">✕</el-button>
  262. </template>
  263. </el-upload> -->
  264. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  265. @onRemove="(file, fileList, fileIndex) => handleRemove(file, fileList, index_experience, fileIndex, 'detail')"
  266. @onSuccess="(file, fileList) => handleUploadSuccess(file, fileList, index_experience, 'detail')"
  267. :fileList="inputForm.detailInfos[index_experience].fileInfoLost" :limit="3"
  268. :isDelete="nodeFlag" :isUpload="nodeFlag">
  269. </UploadComponent>
  270. </u-form-item>
  271. </el-col>
  272. <el-col :span="24" style="text-align: center">
  273. <u-form-item label="">
  274. <el-button style="width: 100%" :disabled="true" type="danger"
  275. @click="removeRow(index_experience)" plain>删除采购详情 {{ index_experience + 1 }}</el-button>
  276. </u-form-item>
  277. </el-col>
  278. </el-row>
  279. <u-form-item label="">
  280. <el-button style="width: 100%" type="primary" :disabled="true" @click="addRow()"
  281. plain>新增采购详情</el-button>
  282. </u-form-item>
  283. <u-form-item label="附件" v-if="false">
  284. <!-- <el-upload :disabled="true" class="upload-demo"
  285. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  286. :on-remove="(file, fileList) => handleRemove(file, fileList, '', '')" :file-list="inputForm.files"
  287. :on-success="(response, file, fileList) => handleUploadSuccess(response, file, fileList, '', '')"
  288. :limit="3">
  289. <el-button size="small" :disabled="true" type="primary">点击上传</el-button>
  290. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  291. <template slot="file" slot-scope="{ file }" v-if="shouldShowFile(file) || testFlag">
  292. <span @click="handleFileClick(file)">{{ file.name }}</span>
  293. <el-button type="text" icon="el-icon-close" @click="handleDelete(file)">✕</el-button>
  294. </template>
  295. </el-upload> -->
  296. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  297. @onRemove="(file, fileList, fileIndex) => handleRemove(file, fileList, '', fileIndex, '')"
  298. @onSuccess="(file, fileList) => handleUploadSuccess(file, fileList, '', '')"
  299. :fileList="inputForm.files" :limit="3" :isDelete="nodeFlag" :isUpload="nodeFlag">
  300. </UploadComponent>
  301. </u-form-item>
  302. </u--form>
  303. <user-select ref="userPicker" @input="handleEvent"></user-select>
  304. <ba-tree-picker ref="treePicker" :multiple='false' @select-change="selectChange" title="类型选择"
  305. :localdata="listData" valueKey="value" textKey="label" childrenKey="children" />
  306. </view>
  307. </template>
  308. <script>
  309. import userSelect from '@/components/user-select/user-select-radio.vue'
  310. import OSSService from "@/api/sys/OSSService"
  311. import GoodsSelector from './GoodsSelector.vue';
  312. import MaterialTypeService from '@/api/psi/MaterialTypeService'
  313. import MaterialManagementService from '@/api/psi/MaterialManagementService'
  314. import CommonApi from '@/api/common/CommonApi'
  315. import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue"
  316. import { mapState, mapMutations, mapActions } from 'vuex'
  317. import registerService from '@/api/human/register/RegisterService'
  318. import UploadComponent from '@/pages/common/UploadComponent.vue';
  319. import upload from '@/utils/upload.js'
  320. export default {
  321. components: {
  322. userSelect,
  323. baTreePicker,
  324. GoodsSelector,
  325. UploadComponent
  326. },
  327. computed: mapState({
  328. userInfo: (state) => state.user.userInfo,
  329. avatar: (state) => state.user.avatar
  330. }),
  331. data() {
  332. return {
  333. uploadUrl: upload.UPLOAD_URL,
  334. showFileList: [], // 控制每个文件是否显示的数组
  335. showFileList2: [], // 控制每个文件是否显示的数组
  336. testFlag: false,
  337. nodeFlag: false,
  338. loading: false,
  339. listData: [],
  340. fileList3: [],
  341. materialList: [],
  342. inputForm: {
  343. tradeTotalPrice: '',
  344. fileInfoLost: [],
  345. purchaseNo: '',
  346. purchaseSketch: '',
  347. handledBy: '',
  348. handledById: '',
  349. handledByOffice: '',
  350. handledByOfficeName: '',
  351. userId: '',
  352. purchaseDate: '',
  353. purchaseMode: '',
  354. remarks: '',
  355. detailInfos: [],
  356. files: [], // 附件信息
  357. procInsId: '',
  358. processDefinitionId: '',
  359. status: ''
  360. },
  361. rules: {
  362. 'purchaseDate': [
  363. {
  364. required: true,
  365. message: '采购申请时间不能为空',
  366. trigger: ['blur', 'change']
  367. }
  368. ],
  369. 'purchaseSketch': [
  370. {
  371. required: true,
  372. message: '采购名称不能为空',
  373. trigger: ['blur', 'change']
  374. }
  375. ],
  376. 'purchaseMode': [
  377. {
  378. required: true,
  379. message: '采购方式不能为空',
  380. trigger: ['blur', 'change']
  381. }
  382. ],
  383. }
  384. }
  385. },
  386. materialTypeService: null,
  387. materialManagementService: null,
  388. ossService: null,
  389. commonApi: null,
  390. // 页面加载时执行
  391. created() {
  392. this.ensureServices()
  393. this.materialTypeService.cgList().then((data) => {
  394. this.materialList = data
  395. }).catch((e) => {
  396. throw e
  397. })
  398. this.inputForm.handledBy = this.userInfo.name
  399. this.inputForm.handledById = this.userInfo.id
  400. this.inputForm.userId = this.userInfo.id
  401. this.inputForm.handledByOffice = this.userInfo.officeDTO.id
  402. this.inputForm.handledByOfficeName = this.userInfo.officeDTO.name
  403. if (!this.inputForm.purchaseSketch) {
  404. this.inputForm.purchaseSketch = `${this.inputForm.handledBy} ${this.formatDate(new Date())} 申请`
  405. }
  406. // 监听事件
  407. uni.$on('eventName', (data) => {
  408. // 在这里处理传递过来的数据
  409. //循环遍历采购详情,估计index将用户id与用户名称放入到采购人里面
  410. this.inputForm.detailInfos.forEach((detail, index) => {
  411. if (index === parseInt(data.index)) {
  412. detail.purchaserAgent = data.name
  413. detail.purchaserAgentId = data.id
  414. detail.procurementOffice = data.officeDTO.name
  415. }
  416. })
  417. });
  418. },
  419. props: {
  420. businessId: {
  421. type: String,
  422. default: ''
  423. },
  424. formReadOnly: {
  425. type: Boolean,
  426. default: false
  427. },
  428. status: {
  429. type: String,
  430. default: ''
  431. }
  432. },
  433. watch: {
  434. 'businessId': {
  435. handler(newVal) {
  436. if (this.businessId) {
  437. this.init(this.businessId)
  438. } else {
  439. this.$nextTick(() => {
  440. // this.$refs.inputForm.reset()
  441. })
  442. }
  443. },
  444. immediate: true,
  445. deep: false
  446. }
  447. },
  448. methods: {
  449. ensureServices() {
  450. if (!this.commonApi) {
  451. this.commonApi = new CommonApi()
  452. }
  453. if (!this.materialTypeService) {
  454. this.materialTypeService = new MaterialTypeService()
  455. }
  456. if (!this.materialManagementService) {
  457. this.materialManagementService = new MaterialManagementService()
  458. }
  459. if (!this.ossService) {
  460. this.ossService = new OSSService()
  461. }
  462. },
  463. // 显示选择器
  464. showPicker(index) {
  465. this.$refs.treePicker._show(index);
  466. },
  467. //鐩戝惉閫夋嫨
  468. selectChange(ids, names, index) {
  469. this.$set(this.inputForm.detailInfos, index, {
  470. ...this.inputForm.detailInfos[index],
  471. procurementType: names,
  472. procurementTypeId: ids[0],
  473. tradeName: '',
  474. goodsName: '',
  475. tradePrice: '',
  476. tradeNumber: '',
  477. priceSum: '',
  478. company: '',
  479. brand: '',
  480. specification: '',
  481. spec: '1',
  482. surplusNumber: ''
  483. });
  484. },
  485. handleGoodsSelected({ index, item }) {
  486. const tradeName = item.tradeName || item.name || ''
  487. const categoryId = this.inputForm.detailInfos[index] && this.inputForm.detailInfos[index].procurementTypeId
  488. const exists = this.inputForm.detailInfos.some((detail, detailIndex) => {
  489. if (String(detailIndex) === String(index)) {
  490. return false
  491. }
  492. return String(detail.procurementTypeId || '') === String(categoryId || '') &&
  493. String(detail.tradeName || '') === String(tradeName || '')
  494. })
  495. if (exists) {
  496. uni.showToast({
  497. title: '同种商品只能选择一次',
  498. icon: 'none'
  499. })
  500. return
  501. }
  502. this.$set(this.inputForm.detailInfos, index, {
  503. ...this.inputForm.detailInfos[index],
  504. tradeName,
  505. goodsName: tradeName,
  506. brand: item.brand || '',
  507. specification: item.specification || '',
  508. company: item.company || this.inputForm.detailInfos[index].company || '',
  509. spec: '1',
  510. surplusNumber: item.currentInventory || item.tradeNumber || item.surplusNumber || ''
  511. });
  512. },
  513. init(id) {
  514. this.ensureServices()
  515. this.nodeFlag = true
  516. this.inputForm.id = id
  517. if (id) {
  518. console.log(id);
  519. this.materialManagementService.findById(id).then((data) => {
  520. if (this.status === 'testSee') {
  521. this.nodeFlag = true
  522. } else {
  523. this.commonApi.getTaskNameByProcInsId(data.procInsId).then((data) => {
  524. if (this.isNotEmpty(data)) {
  525. if (data === '发起人重新申请' || this.isEmpty(data)) {
  526. this.nodeFlag = false
  527. } else {
  528. this.nodeFlag = true
  529. }
  530. }
  531. })
  532. }
  533. this.inputForm = this.recover(this.inputForm, data)
  534. this.inputForm.purchaseDate = new Date(data.purchaseDate);
  535. if (this.inputForm.files) {
  536. this.inputForm.files.forEach((item, index) => {
  537. this.$set(this.showFileList, index, true);
  538. })
  539. }
  540. this.inputForm.detailInfos.forEach((item, index) => {
  541. if (this.isNotEmpty(item.fileInfoLost)) {
  542. this.fileList3[index] = []
  543. item.fileInfoLost.forEach((item, index2) => {
  544. this.fileList3[index].push(item)
  545. this.$set(this.showFileList2, index2, true);
  546. })
  547. }
  548. this.inputForm.detailInfos[index].priceSum = parseFloat(parseFloat(this.inputForm.detailInfos[index].tradePrice)
  549. * parseFloat(this.inputForm.detailInfos[index].tradeNumber)).toFixed(2)
  550. })
  551. this.calculateTradeTotalPrice()
  552. })
  553. }
  554. },
  555. buildTree(nodes, parentId = '0') {
  556. const tree = [];
  557. for (const node of nodes) {
  558. if (String(node.infoType || node.info_type || '') === '1') {
  559. continue
  560. }
  561. if (node.parentId === parentId) {
  562. const children = this.buildTree(nodes, node.id);
  563. if (children.length) {
  564. node.children = children;
  565. }
  566. tree.push(node);
  567. }
  568. }
  569. return tree;
  570. },
  571. formatDate(date) {
  572. const dateNew = new Date(date); // 将日期字符串转换为 Date 对象
  573. const year = dateNew.getFullYear();
  574. const month = (dateNew.getMonth() + 1).toString().padStart(2, '0');
  575. const day = dateNew.getDate().toString().padStart(2, '0');
  576. return `${year}-${month}-${day}`;
  577. },
  578. isEmpty(value) {
  579. let result = false;
  580. if (value == null || value == undefined) {
  581. result = true;
  582. }
  583. if (typeof value == 'string' && (value.replace(/\s+/g, "") == "" || value == "")) {
  584. result = true;
  585. }
  586. if (typeof value == "object" && value instanceof Array && value.length === 0) {
  587. result = true;
  588. }
  589. return result;
  590. },
  591. isNotEmpty(value) {
  592. return !this.isEmpty(value)
  593. },
  594. /**
  595. * 判断是否为空
  596. */
  597. isNull(val) {
  598. if (val instanceof Array) {
  599. if (val.length === 0) return true;
  600. } else if (val instanceof Object) {
  601. if (JSON.stringify(val) === "{}") return true;
  602. } else {
  603. if (
  604. val === "null" ||
  605. val == null ||
  606. val === "undefined" ||
  607. val === undefined ||
  608. val === ""
  609. )
  610. return true;
  611. return false;
  612. }
  613. return false;
  614. },
  615. addRow() {
  616. // 点击新增按钮时,向表格中添加一行空数据
  617. this.inputForm.detailInfos.push({
  618. purchaserAgent: this.userInfo.name,
  619. purchaserAgentId: this.userInfo.id,
  620. procurementOffice: this.userInfo.officeDTO.name,
  621. deptId: this.userInfo.officeDTO.id,
  622. procurementType: '',
  623. procurementTypeId: '',
  624. tradeName: '',
  625. goodsName: '',
  626. tradePrice: '',
  627. tradeNumber: '',
  628. priceSum: '',
  629. company: '',
  630. brand: '',
  631. specification: '',
  632. spec: '1',
  633. surplusNumber: '',
  634. remarks: '',
  635. fileInfoLost: []
  636. });
  637. let valueData = this.materialList;
  638. // 将扁平数据转换为树形结构
  639. const result = this.buildTree(valueData);
  640. this.listData = result
  641. },
  642. calculateTradeTotalPrice() {
  643. this.inputForm.tradeTotalPrice = this.inputForm.detailInfos.reduce((total, item) => {
  644. return total + parseFloat(item.priceSum || 0);
  645. }, 0).toFixed(2)
  646. },
  647. removeRow(index) {
  648. // 点击删除按钮时,从表格中移除指定行
  649. // this.tableData.splice(index, 1);
  650. this.inputForm.detailInfos.splice(index, 1);
  651. },
  652. formatDateNew(date) {
  653. const year = date.getFullYear();
  654. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  655. const day = date.getDate().toString().padStart(2, '0');
  656. const hours = date.getHours().toString().padStart(2, '0');
  657. const minutes = date.getMinutes().toString().padStart(2, '0');
  658. const seconds = date.getSeconds().toString().padStart(2, '0');
  659. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  660. },
  661. // 采购人下拉弹窗
  662. openUserPullForm(index) {
  663. // 点击 "采购人" 输入框时打开userPullForm页面,传入index用于区分不同的行
  664. // uni.navigateTo({
  665. // url: '/pages/materialManagement/collect/UserPullForm?index=' + index // userPullForm页面的路径
  666. // });
  667. this.$refs.userPicker.open(index, "");
  668. },
  669. handleEvent(data, index, type) {
  670. // 在这里处理子组件传递过来的数据
  671. this.inputForm.detailInfos[index].purchaserAgentId = data.id
  672. this.inputForm.detailInfos[index].purchaserAgent = data.label
  673. this.inputForm.detailInfos[index].procurementOffice = data.parentLabel
  674. this.inputForm.detailInfos[index].deptId = data.parentId
  675. // 进行进一步处理...
  676. },
  677. handleUploadSuccess(file, fileList, index, type) {
  678. if (type === 'detail') {
  679. // 将格式化后的数据设置到 detailInfos 的 fileInfoLost 属性中
  680. this.inputForm.detailInfos[index].fileInfoLost = fileList;
  681. // 遍历 fileList,找到上传成功的文件,设置对应索引的 showFileList2 为 true
  682. fileList.forEach((item, i) => {
  683. if (item === file) {
  684. this.$set(this.showFileList2, i, true);
  685. }
  686. });
  687. } else {
  688. // this.inputForm.files = fileList
  689. fileList.forEach((item, index) => {
  690. if (item === file) {
  691. this.$set(this.showFileList, index, true);
  692. }
  693. });
  694. console.log(this.inputForm.files);
  695. }
  696. // 强制更新视图
  697. this.$forceUpdate();
  698. },
  699. handleRemove(file, fileList, lineIndex, fileindex, type) {
  700. // 处理移除文件逻辑
  701. // file 是移除的文件
  702. // fileList 是当前文件列表
  703. if (type === 'detail') {
  704. this.inputForm.detailInfos[lineIndex].fileInfoLost.splice(fileindex, 1);
  705. this.showFileList2.splice(fileindex, 1); // 从showFileList中移除对应的元素
  706. } else {
  707. this.inputForm.files.splice(fileindex, 1);
  708. this.showFileList.splice(fileindex, 1); // 从showFileList中移除对应的元素
  709. }
  710. // 如果你想要更新文件列表,可以在这里更新 inputForm.fileInfoLost
  711. // this.inputForm.fileInfoLost = fileList;
  712. },
  713. saveForm(callback) {
  714. return new Promise((resolve, reject) => {
  715. // 表单规则验证
  716. // ...
  717. let errors = [];
  718. if (this.isNotEmpty(this.inputForm.purchaseDate)) {
  719. this.inputForm.purchaseDate = this.formatDate(this.inputForm.purchaseDate);
  720. }
  721. if (this.isEmpty(this.inputForm.detailInfos)) {
  722. errors.push('至少填写一条采购详情信息');
  723. } else {
  724. let i = this.inputForm.detailInfos.length;
  725. for (let j = 0; j < i; j++) {
  726. let k = j + 1
  727. if (this.isEmpty(this.inputForm.detailInfos[j].purchaserAgent)) {
  728. this.$message.error('采购详情第' + k + '行请选择采购人')
  729. this.loading = false
  730. return
  731. }
  732. if (this.isEmpty(this.inputForm.detailInfos[j].procurementType)) {
  733. this.$message.error('采购详情第' + k + '行请选择采购类型')
  734. this.loading = false
  735. return
  736. }
  737. if (this.isEmpty(this.inputForm.detailInfos[j].tradeName)) {
  738. this.$message.error('采购详情第' + k + '行请填写商品名称')
  739. this.loading = false
  740. return
  741. }
  742. }
  743. for (let j = 0; j < i; j++) {
  744. for (let k = j + 1; k < i; k++) {
  745. if (this.inputForm.detailInfos[j].procurementType === this.inputForm.detailInfos[k].procurementType) { // 如果采购类型相同
  746. if (this.inputForm.detailInfos[j].tradeName === this.inputForm.detailInfos[k].tradeName) { // 如果商品名称相同
  747. this.$message.warning(`采购详情中,同种采购类型的商品名称只能输入一条`)
  748. this.loading = false
  749. throw new Error('采购详情中,同种采购类型的商品名称只能输入一条')
  750. }
  751. }
  752. }
  753. }
  754. }
  755. // 计算总价
  756. this.calculateTradeTotalPrice()
  757. if (errors.length > 0) {
  758. // 存在错误,显示提示信息
  759. errors.forEach(error => {
  760. uni.showToast({
  761. title: error,
  762. icon: 'none',
  763. duration: 2000
  764. });
  765. });
  766. reject('Form validation failed');
  767. } else {
  768. // 所有验证通过,执行保存操作
  769. this.$refs.inputForm.validate().then(() => {
  770. uni.showLoading();
  771. this.inputForm.status = '1';
  772. this.materialManagementService.save(this.inputForm).then(data => {
  773. callback(data.businessTable, data.businessId);
  774. resolve('Form saved successfully');
  775. }).catch(error => {
  776. reject('Save operation failed');
  777. });
  778. }).catch(() => {
  779. reject('Form validation failed');
  780. });
  781. }
  782. });
  783. },
  784. // 修改状态
  785. async updateStatusById(type, callback) {
  786. if (type === 'reject' || type === 'reback') {
  787. this.materialManagementService.findById(this.inputForm.id).then((data) => {
  788. if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
  789. this.loading = false
  790. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  791. throw new Error()
  792. } else {
  793. if (type === 'reject') {
  794. // 驳回
  795. this.inputForm.status = '4'
  796. }
  797. if (type === 'reback') {
  798. // 撤回
  799. this.inputForm.status = '3'
  800. }
  801. if (type === 'reject' || type === 'reback') {
  802. let param = { status: this.inputForm.status, id: this.inputForm.id }
  803. this.materialManagementService.updateStatusById(param).then(() => {
  804. this.loading = false
  805. callback()
  806. })
  807. }
  808. }
  809. })
  810. } else if (type === 'hold') {
  811. this.materialManagementService.findById(this.inputForm.id).then((data) => {
  812. if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
  813. this.loading = false
  814. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  815. throw new Error()
  816. } else {
  817. // 终止
  818. let param = { status: '1', id: this.inputForm.id }
  819. this.materialManagementService.updateStatusById(param).then(() => {
  820. this.loading = false
  821. callback()
  822. })
  823. }
  824. })
  825. }
  826. },
  827. reapplyForm(callback) {
  828. this.loading = true
  829. this.materialManagementService.findById(this.inputForm.id).then((data) => {
  830. if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
  831. this.loading = false
  832. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  833. throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  834. } else {
  835. this.startFormTrue(callback)
  836. }
  837. })
  838. },
  839. // 送审
  840. async startFormTrue(callback) {
  841. if (this.isNotEmpty(this.inputForm.purchaseDate)) {
  842. this.inputForm.purchaseDate = this.formatDate(this.inputForm.purchaseDate);
  843. }
  844. this.$refs.inputForm.validate().then(res => {
  845. this.inputForm.status = '2'
  846. this.calculateTradeTotalPrice()
  847. this.materialManagementService.save(this.inputForm).then((data) => {
  848. this.inputForm.id = data.businessId
  849. callback(data.businessTable, data.businessId, this.inputForm)
  850. this.$refs.inputForm.resetFields()
  851. this.loading = false
  852. }).catch(() => {
  853. this.$refs.inputForm.resetFields()
  854. }).catch((e) => {
  855. })
  856. })
  857. },
  858. // 通过
  859. async agreeForm(callback) {
  860. if (this.isNotEmpty(this.inputForm.purchaseDate)) {
  861. this.inputForm.purchaseDate = this.formatDate(this.inputForm.purchaseDate);
  862. }
  863. this.$refs.inputForm.validate().then(res => {
  864. this.calculateTradeTotalPrice()
  865. this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data) => {
  866. if (this.isNotEmpty(data)) {
  867. if (data === '领导审批') {
  868. this.inputForm.status = '5'
  869. }
  870. }
  871. this.materialManagementService.save(this.inputForm).then((data) => {
  872. callback(data.businessTable, data.businessId, this.inputForm)
  873. this.$refs.inputForm.resetFields()
  874. this.loading = false
  875. }).catch(() => {
  876. this.loading = false
  877. this.$refs.inputForm.resetFields()
  878. })
  879. })
  880. })
  881. },
  882. // 值改变事件
  883. changeValue() {
  884. let i = this.inputForm.detailInfos.length
  885. for (let j = 0; j < i; j++) {
  886. if (this.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
  887. if (this.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
  888. // parseFloat(item.account).toFixed(2)
  889. this.inputForm.detailInfos[j].priceSum = parseFloat(parseFloat(this.inputForm.detailInfos[j].tradePrice) * parseFloat(this.inputForm.detailInfos[j].tradeNumber)).toFixed(2)
  890. } else {
  891. this.inputForm.detailInfos[j].priceSum = ''
  892. }
  893. } else {
  894. this.inputForm.detailInfos[j].priceSum = ''
  895. }
  896. }
  897. this.calculateTradeTotalPrice()
  898. },
  899. async handleFileClick(file) {
  900. await this.ossService.getTemporaryUrl(file.url).then((data) => {
  901. file.lsUrl = data
  902. })
  903. if (this.isImage(file.name)) {
  904. // 如果是图片文件,则执行放大显示图片的逻辑
  905. this.handleImageClick(file);
  906. } else {
  907. // window.open(file.lsUrl, '_blank')
  908. window.location.href = file.lsUrl
  909. // 如果不是图片文件,则执行其他操作,比如下载文件等
  910. }
  911. },
  912. // 判断文件是否是图片类型
  913. isImage(fileName) {
  914. const ext = fileName.toLowerCase().split('.').pop(); // 获取文件的后缀名
  915. return ['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext); // 判断后缀名是否是图片类型
  916. },
  917. handleImageClick(file) {
  918. // 在点击图片时执行放大显示的逻辑
  919. this.$alert(`<img src="${file.lsUrl}" style="max-width: 100%; max-height: 100%;" />`, '图片详情', {
  920. dangerouslyUseHTMLString: true,
  921. customClass: 'custom-alert'
  922. });
  923. },
  924. handleDelete(file, lineIndex, type) {
  925. // 处理删除文件的逻辑
  926. if (type === 'detail') {
  927. const index = this.inputForm.detailInfos[lineIndex].fileInfoLost.indexOf(file);
  928. if (index !== -1) {
  929. this.inputForm.detailInfos[lineIndex].fileInfoLost.splice(index, 1);
  930. this.showFileList2.splice(index, 1); // 从showFileList中移除对应的元素
  931. }
  932. } else {
  933. // 从文件列表中移除文件
  934. const index = this.inputForm.files.indexOf(file);
  935. if (index !== -1) {
  936. this.inputForm.files.splice(index, 1);
  937. this.showFileList.splice(index, 1); // 从showFileList中移除对应的元素
  938. }
  939. }
  940. },
  941. shouldShowFile(file, index, type) {
  942. if (type === 'detail') {
  943. if (this.inputForm.detailInfos[index].fileInfoLost && this.inputForm.detailInfos[index].fileInfoLost.length > 0) {
  944. // 返回一个布尔值,确定是否显示上传成功后的文件
  945. return this.showFileList2[this.inputForm.detailInfos[index].fileInfoLost.indexOf(file)];
  946. }
  947. } else {
  948. if (this.inputForm.files && this.inputForm.files.length > 0) {
  949. // 返回一个布尔值,确定是否显示上传成功后的文件
  950. return this.showFileList[this.inputForm.files.indexOf(file)];
  951. }
  952. }
  953. return false; // 默认返回 false 或者其他适当的
  954. },
  955. onInputCode(index, event, type) {
  956. const inputValue = event
  957. const formattedValue = this.formatInput(inputValue);
  958. if (type === 'tradePrice') {
  959. this.$set(this.inputForm.detailInfos[index], 'tradePrice', formattedValue)
  960. }
  961. if (type === 'tradeNumber') {
  962. this.$set(this.inputForm.detailInfos[index], 'tradeNumber', formattedValue)
  963. }
  964. if (this.isNotEmpty(this.inputForm.detailInfos[index].tradePrice && this.inputForm.detailInfos[index].tradeNumber)) {
  965. let priceSum =
  966. parseFloat(parseFloat(this.inputForm.detailInfos[index].tradePrice) * parseFloat(this.inputForm.detailInfos[index].tradeNumber)).toFixed(2)
  967. this.$set(this.inputForm.detailInfos[index], 'priceSum', priceSum)
  968. }
  969. this.calculateTradeTotalPrice()
  970. },
  971. // 通用的输入限制和格式化方法
  972. formatInput(inputValue, decimalLimit = 2) {
  973. console.log('inputValue', inputValue)
  974. // 如果输入值不是数字或者不是有效的小数,则返回空字符串
  975. if (!/^\d*\.?\d*$/.test(inputValue)) {
  976. return '';
  977. }
  978. // 只保留数字和一个小数点
  979. let value = inputValue.replace(/[^\d.]/g, '');
  980. // 只允许一个小数点
  981. const dotIndex = value.indexOf('.');
  982. if (dotIndex !== -1) {
  983. const substr = value.substr(dotIndex + 1);
  984. if (substr.indexOf('.') !== -1) {
  985. value = value.substr(0, dotIndex + 1) + substr.replace(/\./g, '');
  986. }
  987. }
  988. // 限制小数位数为指定的decimalLimit位数
  989. if (dotIndex !== -1) {
  990. const integerPart = value.substring(0, dotIndex);
  991. const decimalPart = value.substring(dotIndex + 1);
  992. if (decimalPart.length > decimalLimit) {
  993. uni.showToast({
  994. title: '商品数量小数点后只能输入两位,请正确输入!',
  995. icon: 'none',
  996. duration: 2000
  997. });
  998. return ''; // 返回空字符串
  999. }
  1000. value = integerPart + '.' + decimalPart;
  1001. }
  1002. return value;
  1003. },
  1004. }
  1005. }
  1006. </script>
  1007. <style>
  1008. .cu-form-group .title {
  1009. min-width: calc(4em + 40px);
  1010. }
  1011. .custom-alert {
  1012. max-width: 80% !important;
  1013. max-height: 80% !important;
  1014. }
  1015. /* 样式示例,您可能需要根据实际情况调整 */
  1016. .upload-demo {
  1017. width: 40%;
  1018. }
  1019. </style>