index.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="88px">
  4. <el-row>
  5. <el-form-item label="客户名称" prop="fCorpid">
  6. <el-select
  7. v-model="queryParams.fCorpid"
  8. filterable
  9. remote
  10. clearable
  11. style="width: 200px"
  12. @keyup.enter.native="handleQuery"
  13. :remote-method="corpsRemoteMethod"
  14. placeholder="请输入客户名称"
  15. >
  16. <el-option
  17. v-for="(dict, index) in fMblnoOptions"
  18. :key="index.fId"
  19. :label="dict.fName"
  20. :value="dict.fId"
  21. ></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="制单部门" prop="fDeptid">
  25. <el-input
  26. v-model="queryParams.fDeptid"
  27. placeholder="请输入制单部门"
  28. clearable
  29. size="small"
  30. @keyup.enter.native="handleQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item label="有效期起" prop="fBegindate">
  34. <el-date-picker clearable size="small" style="width: 200px"
  35. v-model="queryParams.fBegindate"
  36. type="date"
  37. value-format="yyyy-MM-dd"
  38. placeholder="选择有效期起"
  39. >
  40. </el-date-picker>
  41. </el-form-item>
  42. <el-form-item label="有效期至" prop="fEnddate">
  43. <el-date-picker clearable size="small" style="width: 200px"
  44. v-model="queryParams.fEnddate"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="选择有效期至"
  48. >
  49. </el-date-picker>
  50. </el-form-item>
  51. <el-form-item label="协议编号" prop="fContractno">
  52. <el-input
  53. v-model="queryParams.fContractno"
  54. placeholder="请输入协议编号"
  55. clearable
  56. size="small"
  57. @keyup.enter.native="handleQuery"
  58. />
  59. </el-form-item>
  60. <el-form-item label="作业费类型" prop="fTaskType" label-width="90px">
  61. <el-select v-model="queryParams.fTaskType" clearable placeholder="请选择作业费类型" :disabled="browseStatus">
  62. <el-option label="车队作业费" value="1"/>
  63. <el-option label="劳务作业费" value="2"/>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="商品类别" prop="tPackages">
  67. <el-select v-model="queryParams.tPackages" clearable placeholder="请选择商品类别" :disabled="browseStatus">
  68. <el-option
  69. v-for="dict in fTypeidOptions"
  70. :key="dict.dictValue"
  71. :label="dict.dictLabel"
  72. :value="dict.dictValue"
  73. style="width: 200px;"
  74. ></el-option>
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="费用类型" prop="fDc">
  78. <el-select v-model="queryParams.fDc" clearable placeholder="请选择费用类型" style="width: 200px;" :disabled="browseStatus">
  79. <el-option label="收" value="D"></el-option>
  80. <el-option label="付" value="C"></el-option>
  81. </el-select>
  82. </el-form-item>
  83. <el-form-item>
  84. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  85. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  86. </el-form-item>
  87. </el-row>
  88. </el-form>
  89. <el-row :gutter="10" class="mb8">
  90. <el-col :span="1.5">
  91. <el-button
  92. type="primary"
  93. icon="el-icon-plus"
  94. size="mini"
  95. @click="handleAdd()"
  96. v-hasPermi="['agreement:agreementTask:add']"
  97. >新增
  98. </el-button>
  99. </el-col>
  100. <!-- <el-col :span="1.5">-->
  101. <!-- <el-button-->
  102. <!-- type="success"-->
  103. <!-- icon="el-icon-edit"-->
  104. <!-- size="mini"-->
  105. <!-- :disabled="single"-->
  106. <!-- @click="handleUpdate"-->
  107. <!-- v-hasPermi="['agreement:agreementTask:edit']"-->
  108. <!-- >修改-->
  109. <!-- </el-button>-->
  110. <!-- </el-col>-->
  111. <!-- <el-col :span="1.5">-->
  112. <!-- <el-button-->
  113. <!-- type="danger"-->
  114. <!-- icon="el-icon-delete"-->
  115. <!-- size="mini"-->
  116. <!-- :disabled="multiple"-->
  117. <!-- @click="handleDelete"-->
  118. <!-- v-hasPermi="['agreement:agreementTask:remove']"-->
  119. <!-- >删除-->
  120. <!-- </el-button>-->
  121. <!-- </el-col>-->
  122. <el-col :span="1.5">
  123. <el-button
  124. type="warning"
  125. icon="el-icon-download"
  126. size="mini"
  127. @click="handleExport"
  128. v-hasPermi="['agreement:agreementTask:export']"
  129. >导出
  130. </el-button>
  131. </el-col>
  132. <el-col :span="1.5">
  133. <el-button
  134. type="info"
  135. icon="el-icon-download"
  136. size="mini"
  137. :disabled="single"
  138. @click="handleUpdate(null,2)"
  139. v-hasPermi="['agreement:agreementStorage:export']"
  140. >复制新增
  141. </el-button>
  142. </el-col>
  143. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  144. </el-row>
  145. <el-table v-loading="loading" :data="agreementList" @selection-change="handleSelectionChange">
  146. <el-table-column type="selection" width="55" align="center"/>
  147. <el-table-column type="index" label="行号" align="center" fixed/>
  148. <el-table-column label="客户名称" sortable align="center" prop="fCorpid" fixed width="220"/>
  149. <el-table-column label="作业费类型" sortable align="center" prop="fTaskType" fixed width="220">
  150. <template slot-scope="scope">
  151. <span v-if="scope.row.fTaskType === 1">车队作业费</span>
  152. <span v-if="scope.row.fTaskType === 2">劳务作业费</span>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="商品类别" sortable align="center" prop="tPackages" fixed width="220" :formatter="tPackagesFormat"/>
  156. <el-table-column label="费用类型" sortable align="center" prop="fDc" fixed width="220">
  157. <template slot-scope="scope">
  158. <span v-if="scope.row.fDc === 'D'">收</span>
  159. <span v-if="scope.row.fDc === 'C'">付</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="协议编号" sortable align="center" prop="fContractno" show-overflow-tooltip/>
  163. <!-- <el-table-column label="费用名称" align="center" prop="fFeeid"/>-->
  164. <el-table-column label="有效期起" sortable align="center" prop="fBegindate" width="180">
  165. <template slot-scope="scope">
  166. <span>{{ parseTime(scope.row.fBegindate, '{y}-{m}-{d}') }}</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="有效期至" sortable align="center" prop="fEnddate" width="180">
  170. <template slot-scope="scope">
  171. <span>{{ parseTime(scope.row.fEnddate, '{y}-{m}-{d}') }}</span>
  172. </template>
  173. </el-table-column>
  174. <!-- <el-table-column label="状态" align="center" prop="fId" />-->
  175. <el-table-column label="是否启用" align="center" prop="fStatus">
  176. <template slot-scope="scope">
  177. <el-switch
  178. v-model="scope.row.fStatus"
  179. active-value="0"
  180. inactive-value="1"
  181. @change="handleStatusChange(scope.row)"
  182. ></el-switch>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="状态" align="center" prop="fBillstatus">
  186. <template slot-scope="scope">
  187. <span v-if="scope.row.fBillstatus == '1'">保存</span>
  188. <span v-else-if="scope.row.fBillstatus == '2'">暂存</span>
  189. <span v-else-if="scope.row.fBillstatus == '3'">审批驳回</span>
  190. <span v-else-if="scope.row.fBillstatus == '4'">提交审核</span>
  191. <span v-else-if="scope.row.fBillstatus == '5'">审核中</span>
  192. <span v-else-if="scope.row.fBillstatus == '6'">审核完成</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  196. <template slot-scope="scope">
  197. <el-button
  198. size="mini"
  199. type="text"
  200. icon="el-icon-view"
  201. @click="speed_s(scope.row,0)"
  202. v-hasPermi="['agreement:agreementTask:remove']"
  203. >查看
  204. </el-button>
  205. <el-button
  206. size="mini"
  207. type="text"
  208. icon="el-icon-edit"
  209. @click="handleUpdate(scope.row)"
  210. v-if="scope.row.fBillstatus <= 3"
  211. v-hasPermi="['agreement:agreementTask:edit']"
  212. >修改
  213. </el-button>
  214. <el-button
  215. size="mini"
  216. type="text"
  217. icon="el-icon-delete"
  218. @click="handleDelete(scope.row)"
  219. v-if="scope.row.fBillstatus <= 3"
  220. v-hasPermi="['agreement:agreementTask:remove']"
  221. >删除
  222. </el-button>
  223. <el-button
  224. size="mini"
  225. type="text"
  226. icon="el-icon-delete"
  227. @click="speed(scope.row,1)"
  228. v-if="scope.row.fBillstatus === '4' || scope.row.fBillstatus === '5'"
  229. v-hasPermi="['agreement:agreementTask:remove']"
  230. >审批进度
  231. </el-button>
  232. </template>
  233. </el-table-column>
  234. <!-- <el-table-column label="业务编号" align="center" prop="fBillno" />-->
  235. <!-- <el-table-column label="制单部门" align="center" prop="fDeptid" />-->
  236. <!-- <el-table-column label="结算方式" align="center" prop="fStltypeid" :formatter="fStltypeidFormat" />-->
  237. <!-- <el-table-column label="费用类型" align="center" prop="fFeetypeid" />-->
  238. <!-- <el-table-column label="货物类别" align="center" prop="tPackages" :formatter="tPackagesFormat" />-->
  239. <!-- <el-table-column label="贸易方式" align="center" prop="fTrademodeid" :formatter="fTrademodeidFormat" />-->
  240. <!-- <el-table-column label="免堆天数" align="center" prop="fFreedays" />-->
  241. <!-- <el-table-column label="备注" align="center" prop="remark" />-->
  242. </el-table>
  243. <pagination
  244. v-show="total>0"
  245. :total="total"
  246. :page.sync="queryParams.pageNum"
  247. :limit.sync="queryParams.pageSize"
  248. @pagination="getList"
  249. />
  250. <!-- 添加或修改作业费对话框 -->
  251. <el-dialog :title="title" :visible.sync="open" :show-close="Xbutton" width="65%" append-to-body :before-close="handleClose" :close-on-click-modal="false">
  252. <el-form ref="form" :model="form" :rules="rules" label-width="80px"
  253. style="display: flex;flex-wrap: wrap;">
  254. <el-form-item label="客户名称" prop="fCorpid">
  255. <el-select
  256. v-model="form.fCorpid"
  257. filterable
  258. remote
  259. clearable
  260. :disabled="browseStatus"
  261. style="width: 200px"
  262. @keyup.enter.native="handleQuery"
  263. :remote-method="corpsRemoteMethod"
  264. placeholder="请输入客户名称"
  265. >
  266. <el-option
  267. v-for="(dict, index) in fMblnoOptions"
  268. :key="index.fId"
  269. :label="dict.fName"
  270. :value="dict.fId"
  271. ></el-option>
  272. </el-select>
  273. </el-form-item>
  274. <el-form-item label="制单部门">
  275. <el-input v-model="deptName" :disabled="true" placeholder="请输入制单部门" style="width: 200px"/>
  276. </el-form-item>
  277. <el-form-item label="有效期起" prop="fBegindate">
  278. <el-date-picker clearable size="small" style="width: 200px"
  279. v-model="form.fBegindate"
  280. type="date"
  281. :disabled="browseStatus"
  282. value-format="timestamp"
  283. placeholder="选择有效期起"
  284. >
  285. </el-date-picker>
  286. </el-form-item>
  287. <el-form-item label="有效期至" prop="fEnddate">
  288. <el-date-picker clearable size="small" style="width: 200px"
  289. v-model="form.fEnddate"
  290. type="date"
  291. :disabled="browseStatus"
  292. value-format="timestamp"
  293. placeholder="选择有效期至"
  294. >
  295. </el-date-picker>
  296. </el-form-item>
  297. <el-form-item label="协议编号" prop="fContractno">
  298. <el-input v-model="form.fContractno" placeholder="请输入协议编号" :disabled="browseStatus" style="width: 200px"/>
  299. </el-form-item>
  300. <el-form-item label="商品类别" prop="tPackages">
  301. <el-select v-model="form.tPackages" placeholder="请选择商品类别" :disabled="browseStatus">
  302. <el-option
  303. v-for="dict in fTypeidOptions"
  304. :key="dict.dictValue"
  305. :label="dict.dictLabel"
  306. :value="dict.dictValue"
  307. style="width: 210px;"
  308. ></el-option>
  309. </el-select>
  310. </el-form-item>
  311. <el-form-item label="作业费类型" prop="fTaskType" label-width="90px">
  312. <el-select v-model="form.fTaskType" placeholder="请选择作业费类型" :disabled="browseStatus">
  313. <el-option label="车队作业费" value="1"/>
  314. <el-option label="劳务作业费" value="2"/>
  315. </el-select>
  316. </el-form-item>
  317. <el-form-item label="费用类型" prop="fDc">
  318. <el-select v-model="form.fDc" @change="changefDc" placeholder="请选择费用类型" :disabled="browseStatus">
  319. <el-option label="收" value="D"></el-option>
  320. <el-option label="付" value="C"></el-option>
  321. </el-select>
  322. </el-form-item>
  323. </el-form>
  324. <el-button @click="confirmCharge" :disabled="stop" v-if="form.fBillstatus < 4" type="primary">请 核</el-button>
  325. <el-button @click="revokeCharge" v-if="form.fBillstatus === '6'" type="danger">撤销请核</el-button>
  326. <el-button @click="revocationApproval" :disabled="tablefilter" v-if="form.fBillstatus === '4' && operator === lander" type="danger">撤销审批</el-button>
  327. <div class="dialogTableTitle flex a-center jlr">
  328. <h2>作业费明细</h2>
  329. <el-button @click="getList_s" :disabled="browseStatus">新增</el-button>
  330. </div>
  331. <el-table v-loading="loading_s" :data="agreementitemsList">
  332. <el-table-column label="行号" align="center" type="index"/>
  333. <el-table-column
  334. prop="fFeeid"
  335. header-align="center"
  336. align="center"
  337. width="180px"
  338. label="费用名称"
  339. >
  340. <template slot-scope="scope">
  341. <el-select
  342. v-model="scope.row.fFeeid"
  343. filterable
  344. :disabled="browseStatus"
  345. remote
  346. :remote-method="fWRemoteMethod"
  347. placeholder="费用名称"
  348. >
  349. <el-option
  350. v-for="(dict, index) in fWbuOptions"
  351. :key="index.fId"
  352. :label="dict.fName"
  353. :value="dict.fId"
  354. ></el-option>
  355. </el-select>
  356. </template>
  357. </el-table-column>
  358. <el-table-column
  359. prop="fFeeunitid"
  360. header-align="center"
  361. align="center"
  362. width="180px"
  363. label="计价单位"
  364. >
  365. <template slot-scope="scope">
  366. <el-select
  367. v-model="scope.row.fFeeunitid"
  368. placeholder="请选择计价单位"
  369. @change="changeFeeUnit(scope.row)"
  370. clearable
  371. :disabled="browseStatus"
  372. >
  373. <el-option
  374. v-for="(dict, index) in jFeetunitOptions"
  375. :key="index.dictValue"
  376. :label="dict.dictLabel"
  377. :value="dict.dictValue"
  378. />
  379. </el-select>
  380. </template>
  381. </el-table-column>
  382. <el-table-column label="单价" align="center">
  383. <el-input
  384. slot-scope="scope"
  385. v-model="scope.row.fPrice"
  386. placeholder="请输入单价"
  387. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  388. :disabled="browseStatus"
  389. clearable
  390. size="small"
  391. />
  392. </el-table-column>
  393. <el-table-column label="录入人" align="center">
  394. <el-input
  395. slot-scope="scope"
  396. v-model="scope.row.createBy"
  397. :disabled="true"
  398. placeholder="默认录入人"
  399. clearable
  400. size="small"
  401. />
  402. </el-table-column>
  403. <el-table-column label="录入时间" align="center">
  404. <el-input
  405. slot-scope="scope"
  406. v-model="scope.row.createTime"
  407. placeholder="默认录入时间"
  408. :disabled="true"
  409. clearable
  410. size="small"
  411. />
  412. </el-table-column>
  413. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  414. <template slot-scope="scope">
  415. <el-button
  416. size="mini"
  417. type="text"
  418. icon="el-icon-delete"
  419. :disabled="browseStatus"
  420. @click.native.prevent="deleteRow(scope.$index, agreementitemsList)"
  421. >删除
  422. </el-button>
  423. </template>
  424. </el-table-column>
  425. </el-table>
  426. <div slot="footer" class="dialog-footer">
  427. <el-button v-if="approvalProhibit" @click="immediateApproval">审批</el-button>
  428. <el-button v-if="form.fBillstatus > 2" @click="viewAudit">查看审批</el-button>
  429. <el-button type="primary" @click="submitForm" :disabled="determine || browseStatus">保 存</el-button>
  430. <el-button v-if="cancelButton === true" @click="cancel">取 消</el-button>
  431. <el-button v-if="cancelButton === false" @click="homePage">取 消</el-button>
  432. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  433. <approval-comments v-if="addOrUpdateVisib" ref="ApprovalComments" @refreshDataList="returnData"></approval-comments>
  434. </div>
  435. </el-dialog>
  436. </div>
  437. </template>
  438. <script>
  439. import moment from 'moment'
  440. import {
  441. listAgreement,
  442. getAgreement,
  443. delAgreement,
  444. addAgreement,
  445. exportAgreement,
  446. listAgreementitems,
  447. queryUserVal,
  448. updateAgreements,
  449. collecTask,
  450. backCharge,
  451. revocation
  452. } from '@/api/agreement/agreement'
  453. import { listCorps } from '@/api/basicdata/corps'
  454. import { listGoods } from '@/api/basicdata/goods'
  455. import { listFees } from '@/api/basicdata/fees'
  456. import AddOrUpdate from '@/views/viewApproval'
  457. import ApprovalComments from '@/views/startApproval'
  458. import Global from '@/layout/components/global.js'
  459. export default {
  460. name: 'Agreement',
  461. components: {
  462. AddOrUpdate,
  463. ApprovalComments
  464. },
  465. data() {
  466. return {
  467. addOrEdid:1,
  468. idCopy:'',
  469. stop:false,
  470. lander:'',
  471. operator:'',
  472. dataList: '',
  473. // 遮罩层
  474. loading: true,
  475. determine:false,
  476. cancelButton:true,
  477. approvalProhibit:false,
  478. loading_s: false,
  479. Xbutton:true,
  480. browseStatus:false,
  481. addOrUpdateVisible:false,
  482. addOrUpdateVisib:false,
  483. tablefilter:false,
  484. // 计价单位
  485. jFeetunitOptions: [
  486. /*{ dictLabel: "件数", dictValue: "1" },
  487. { dictLabel: "毛重", dictValue: "2" },
  488. { dictLabel: "净重", dictValue: "3" },
  489. { dictLabel: "尺码", dictValue: "4" },
  490. { dictLabel: "固定", dictValue: "5" },*/
  491. ],
  492. goodsOptions:[],
  493. fTypeidOptions: [],
  494. // 选中数组
  495. ids: [],
  496. deptName:'',
  497. // 客户(客户数据)
  498. fMblnoOptions: [],
  499. fFeeunitidOptions: [],
  500. fWbuOptions: [],
  501. // 非单个禁用
  502. single: true,
  503. // 非多个禁用
  504. multiple: true,
  505. // 显示搜索条件
  506. showSearch: true,
  507. // 总条数
  508. total: 0,
  509. // 仓储费表格数据
  510. agreementList: [],
  511. // 弹出层标题
  512. title: '',
  513. // 是否显示弹出层
  514. open: false,
  515. // 结算方式,也可以从表t_stltypes中下拉选择,存储id,显示name字典
  516. fStltypeidOptions: [],
  517. // 货物类别,存储t_packages,f_id 显示名称,可以多选t_packages 中的no或 name,模糊查找选择后,存储f_id,显示name字典
  518. tPackagesOptions: [],
  519. // 贸易方式,对应t_trademodels 字典
  520. fTrademodeidOptions: [],
  521. // 仓储费明细表表格数据
  522. agreementitemsList: [],
  523. // 查询参数
  524. queryParams: {
  525. pageNum: 1,
  526. pageSize: 10,
  527. fBillno: null,
  528. fDeptid: null,
  529. fContractno: null,
  530. fCorpid: null,
  531. fStltypeid: null,
  532. fGoodsid: null,
  533. fFeetypeid: null,
  534. tPackages: null,
  535. fTrademodeid: null,
  536. fFreedays: null,
  537. fBegindate: null,
  538. fEnddate: null,
  539. fBillstatus: null,
  540. fTaskType:null,
  541. fDc:null,
  542. },
  543. // 表单参数
  544. form: {
  545. fTaskType: '1',
  546. fDc : "D"
  547. },
  548. // 表单校验
  549. rules: {
  550. fBillno: [
  551. {
  552. required: true,
  553. message: ' ',
  554. trigger: 'blur'
  555. }
  556. ],
  557. fCorpid: [
  558. { required: true, message: ' ', trigger: 'blur' }
  559. ],
  560. tPackages:[
  561. { required: true, message: ' ', trigger: 'blur' }
  562. ],
  563. fBegindate:[
  564. { required: true, message: ' ', trigger: 'blur' }
  565. ],
  566. fEnddate:[
  567. { required: true, message: ' ', trigger: 'blur' }
  568. ]
  569. }
  570. }
  571. },
  572. created() {
  573. this.getList()
  574. this.getDicts('data_settlement_method').then(response => {
  575. this.fStltypeidOptions = response.data
  576. })
  577. this.getDicts('data_package_unit').then(response => {
  578. this.tPackagesOptions = response.data
  579. })
  580. this.getDicts('data_trademodes').then(response => {
  581. this.fTrademodeidOptions = response.data
  582. })
  583. this.getDicts("data_goods_category").then(response => {
  584. this.fTypeidOptions = response.data;
  585. });
  586. this.getDicts("data_unitfees").then(response => {
  587. this.jFeetunitOptions = response.data;
  588. });
  589. let queryParams = { pageNum: 1, type: 1 };
  590. listCorps(queryParams).then((response) => {
  591. this.fMblnoOptions = response.rows;
  592. });
  593. this.register()
  594. },
  595. activated(){
  596. this.adoPt()
  597. },
  598. methods: {
  599. changefDc(){
  600. if(this.form.fDc === 'D'){
  601. let queryParams = { pageNum: 1, pageSize: 10, fDc:'D'};
  602. listFees(queryParams).then((response) => {
  603. this.fWbuOptions = response.rows;
  604. });
  605. }else if(this.form.fDc === 'C'){
  606. let queryParams = { pageNum: 1, pageSize: 10, fDc:'C'};
  607. listFees(queryParams).then((response) => {
  608. this.fWbuOptions = response.rows;
  609. });
  610. }
  611. if(this.agreementitemsList.length){
  612. this.$message.error("请重新选择费用名称")
  613. for(let item in this.agreementitemsList){
  614. this.agreementitemsList[item].fFeeid = ''
  615. }
  616. }
  617. },
  618. // 默认录入人
  619. register() {
  620. queryUserVal().then((response)=>{
  621. this.lander = response.user.userName
  622. })
  623. },
  624. immediateApproval(){
  625. this.addOrUpdateVisib = true
  626. this.$nextTick(() => {
  627. this.$refs.ApprovalComments.init(this.approval.billId,320)
  628. })
  629. },
  630. adoPt(){
  631. this.tablefilter = true
  632. this.approval = this.$route.query.data
  633. if (this.approval){
  634. this.cancelButton = false
  635. this.determine = true
  636. this.Xbutton = false
  637. this.tablefilter = true
  638. this.browseStatus = true
  639. this.approval = JSON.parse(this.approval)
  640. this.approvalProhibit = true
  641. this.pass = {
  642. fAmtdr: '', //应收合计
  643. fAmtcr: '', //应付合计
  644. fMblno: '', //提单号
  645. fName: '', //货权方
  646. fFeesName: '', //结算单位
  647. fCorpid: '' //结算单位ID
  648. }
  649. getAgreement(this.approval.billId).then(response => {
  650. this.deptName = response.data.dept.deptName
  651. this.form = response.data.tWarehouseAgreement
  652. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  653. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  654. this.agreementitemsList = response.data.tWarehouseAgreementitems
  655. for (let item in this.agreementitemsList) {
  656. this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
  657. }
  658. this.fWbuOptions = response.data.feesList
  659. this.open = true
  660. this.title = '修改作业费'
  661. })
  662. }
  663. },
  664. viewAudit(){
  665. this.addOrUpdateVisible = true
  666. this.addOrUpdateVisib = false
  667. let id = '448'
  668. let actId = '110'
  669. this.$nextTick(() => {
  670. this.$refs.addOrUpdate.init(this.form.fId,320)
  671. })
  672. },
  673. returnData(){
  674. this.open = false
  675. this.addOrUpdateVisib = false
  676. this.homePage()
  677. },
  678. getDataList(){
  679. this.addOrUpdateVisible = false
  680. },
  681. homePage(){
  682. let view = {
  683. fullPath: "/agreement/agreementTask",
  684. hash: "",
  685. matched: Array(2),
  686. meta: Object,
  687. name: "AgreementTask",
  688. params: Object,
  689. path: "/agreement/agreementTask",
  690. query: Object,
  691. title: "作业费协议",
  692. }
  693. this.$router.push({ path: '/index' })
  694. this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  695. if (this.isActive(view)) {
  696. this.toLastView(visitedViews, view)
  697. }
  698. })
  699. Global.$emit('removeCache', 'closeSelectedTag', view)
  700. },
  701. /** 创建仓储费明细表列表 */
  702. getList_s() {
  703. queryUserVal().then((response) => {
  704. this.agreementitemsList.push({
  705. //行号
  706. fLineno: '',
  707. //计价单位
  708. fFeeunitid: '',
  709. //费用名称
  710. fFeeid: '',
  711. //开始天数
  712. fFromdays: '',
  713. //结束天数
  714. fEndays: '',
  715. //单价
  716. fPrice: '',
  717. //录入人
  718. createBy: response.user.userName,
  719. //创建时间
  720. createTime: moment(Date.parse(new Date())).format('YYYY-MM-DD HH:mm:ss')
  721. })
  722. this.deptName = response.dept.deptName
  723. this.form.fDeptid = response.dept.deptId
  724. this.agreementitemsList.createBy = response.user.userName
  725. })
  726. },
  727. speed_s(row, res) {
  728. this.stop = true
  729. this.determine = true
  730. this.tablefilter = true
  731. this.browseStatus = true
  732. this.approvalProhibit = false
  733. const fId = row.fId || this.ids
  734. getAgreement(fId).then(response => {
  735. this.deptName = response.data.dept.deptName
  736. this.form = response.data.tWarehouseAgreement
  737. this.$set(this.form, 'fTaskType', this.form.fTaskType + '')
  738. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  739. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  740. this.operator = this.form.createBy
  741. this.agreementitemsList = response.data.tWarehouseAgreementitems
  742. for (let item in this.agreementitemsList) {
  743. this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
  744. }
  745. this.fWbuOptions = response.data.feesList
  746. this.open = true
  747. this.title = '查看作业费'
  748. })
  749. },
  750. speed(row, res) {
  751. this.register()
  752. if (res === 1) {
  753. this.tablefilter = false
  754. }
  755. this.determine = true
  756. this.browseStatus = true
  757. this.approvalProhibit = false
  758. const fId = row.fId || this.ids
  759. getAgreement(fId).then(response => {
  760. this.deptName = response.data.dept.deptName
  761. this.form = response.data.tWarehouseAgreement
  762. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  763. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  764. this.operator = this.form.createBy
  765. this.agreementitemsList = response.data.tWarehouseAgreementitems
  766. for (let item in this.agreementitemsList) {
  767. this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
  768. }
  769. this.fWbuOptions = response.data.feesList
  770. this.open = true
  771. this.title = '查看作业费'
  772. })
  773. },
  774. revocationApproval(){
  775. let data = {
  776. id:this.form.fId,
  777. actId: 320,
  778. billId:this.form.fId
  779. }
  780. revocation(data).then(data =>{
  781. if (data.code === 200){
  782. this.$message.success('撤销成功');
  783. this.open = false
  784. this.getList()
  785. }
  786. })
  787. },
  788. // 请核
  789. confirmCharge() {
  790. if (this.agreementitemsList.length <= 0) {
  791. this.$message.error('作业费明细为空无法操作')
  792. return false
  793. }
  794. for (let agr = 0; agr < this.agreementitemsList.length; agr ++) {
  795. if (!this.agreementitemsList[agr].fFeeid) {
  796. this.$message.error('请维护费用名称')
  797. return false
  798. }
  799. if (!this.agreementitemsList[agr].fFeeunitid) {
  800. this.$message.error('请维计价单位')
  801. return false
  802. }
  803. if (!this.agreementitemsList[agr].fPrice) {
  804. this.$message.error('请维单价')
  805. return false
  806. }
  807. }
  808. this.$refs['form'].validate(valid => {
  809. if (valid) {
  810. let formData = new window.FormData()
  811. formData.append('agreement', JSON.stringify(this.form))
  812. formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
  813. collecTask(formData).then(response => {
  814. this.msgSuccess('请核成功')
  815. this.open = false
  816. this.agreementitemsList = []
  817. this.getList()
  818. })
  819. }
  820. })
  821. },
  822. // 撤销作业费
  823. revokeCharge(){
  824. this.form.fBillstatus = '1'
  825. let formDate = new window.FormData()
  826. formDate.append('agreement', JSON.stringify(this.form))
  827. formDate.append('agreementitems', JSON.stringify(this.agreementitemsList))
  828. backCharge(formDate).then(response => {
  829. this.open = false
  830. this.msgSuccess('操作成功')
  831. this.getList()
  832. })
  833. },
  834. /* 远程模糊查询商品 */
  835. goodsRemoteMethod(name) {
  836. if (name == null || name === "") {
  837. return false;
  838. }
  839. let queryParams = { pageNum: 1, pageSize: 10, fName: name };
  840. listGoods(queryParams).then((response) => {
  841. this.goodsOptions = response.rows;
  842. });
  843. },
  844. // 计价单位
  845. fFeeunitidFormat(row, column) {
  846. return this.selectDictLabel(this.fFeeunitidOptions, row.fFeeunitid);
  847. },
  848. /** 查询作业费列表 */
  849. getList() {
  850. this.loading = true
  851. listAgreement(this.queryParams).then(response => {
  852. this.agreementList = response.rows
  853. this.total = response.total
  854. this.loading = false
  855. })
  856. },
  857. // 结算方式,也可以从表t_stltypes中下拉选择,存储id,显示name字典翻译
  858. fStltypeidFormat(row, column) {
  859. return this.selectDictLabel(this.fStltypeidOptions, row.fStltypeid)
  860. },
  861. // 货物类别,存储t_packages,f_id 显示名称,可以多选t_packages 中的no或 name,模糊查找选择后,存储f_id,显示name字典翻译
  862. tPackagesFormat(row, column) {
  863. return this.selectDictLabel(this.fTypeidOptions, row.tPackages)
  864. },
  865. // 贸易方式,对应t_trademodels 字典翻译
  866. fTrademodeidFormat(row, column) {
  867. return this.selectDictLabel(this.fTrademodeidOptions, row.fTrademodeid)
  868. },
  869. // 取消按钮
  870. cancel() {
  871. this.idCopy = null
  872. this.reset()
  873. this.getList()
  874. this.open = false
  875. },
  876. handleClose(){
  877. this.reset()
  878. this.getList()
  879. this.open = false
  880. },
  881. // 表单重置
  882. reset() {
  883. this.determine = false
  884. this.browseStatus = false
  885. this.agreementitemsList = []
  886. this.form = {
  887. fId: null,
  888. fBillno: null,
  889. fDeptid: null,
  890. fContractno: null,
  891. fCorpid: null,
  892. fStltypeid: null,
  893. fGoodsid: null,
  894. fFeetypeid: null,
  895. tPackages: null,
  896. fTrademodeid: null,
  897. fFreedays: null,
  898. fBegindate: null,
  899. fEnddate: null,
  900. fBillstatus: '0',
  901. delFlag: null,
  902. createBy: null,
  903. createTime: null,
  904. updateBy: null,
  905. updateTime: null,
  906. remark: null
  907. }
  908. this.resetForm('form')
  909. },
  910. /** 搜索按钮操作 */
  911. handleQuery() {
  912. this.queryParams.pageNum = 1
  913. this.getList()
  914. },
  915. // 变更计价单位
  916. changeFeeUnit(row) {
  917. if (!row.fFeeUnitid) {
  918. return false;
  919. }
  920. if (row.fFeeUnitid === "0") {
  921. this.$set(row, "fQty", this.fCntqty);
  922. } else if (row.fFeeUnitid === "1") {
  923. this.$set(row, "fQty", this.fGrossweight);
  924. }
  925. if (row.fUnitprice) {
  926. this.$set(row, "fAmount", parseFloat(Number(row.fUnitprice) * Number(row.fQty)).toFixed(2));
  927. }
  928. },
  929. /** 重置按钮操作 */
  930. resetQuery() {
  931. this.resetForm('queryForm')
  932. this.handleQuery()
  933. },
  934. // 多选框选中数据
  935. handleSelectionChange(selection) {
  936. this.ids = selection.map(item => item.fId)
  937. this.idCopy = this.ids[0]
  938. this.single = selection.length !== 1
  939. this.multiple = !selection.length
  940. },
  941. // 远程模糊查询费用名称
  942. fWRemoteMethod(name) {
  943. this.fWbuOptions = []
  944. if (name == null || name === "") {
  945. return false;
  946. }
  947. let fDc = this.form.fDc
  948. let queryParams = { pageNum: 1, pageSize: 10, fName: name, fDc:fDc};
  949. listFees(queryParams).then((response) => {
  950. this.fWbuOptions = response.rows
  951. });
  952. },
  953. // 作业费状态修改
  954. handleStatusChange(row) {
  955. if (row.fBillstatus == '6'){
  956. let text = row.fStatus === "0" ? "启用" : "停用";
  957. this.$confirm('确认要"' + text + '""' + row.fCorpid + '"用户吗?', "警告", {
  958. confirmButtonText: "确定",
  959. cancelButtonText: "取消",
  960. type: "warning"
  961. }).then(function() {
  962. return updateAgreements(row.fId, row.fStatus);
  963. }).then(() => {
  964. this.msgSuccess(text + "成功");
  965. }).catch(function() {
  966. row.fStatus = row.fStatus === "0" ? "1" : "0";
  967. });
  968. }else {
  969. row.fStatus = 0
  970. this.$message.error('审核完成时才能启用');
  971. }
  972. },
  973. /** 新增按钮操作 */
  974. handleAdd() {
  975. this.stop = false
  976. this.determine = false
  977. this.browseStatus = false
  978. this.reset()
  979. this.open = true
  980. this.title = '添加作业费'
  981. this.form = {
  982. fTaskType :'1',
  983. fDc:"D"
  984. }
  985. queryUserVal().then((response) => {
  986. this.deptName = response.dept.deptName
  987. this.form.fDeptid = response.dept.deptId
  988. });
  989. },
  990. /** 修改按钮操作 */
  991. handleUpdate(row,num) {
  992. if(num === 2){
  993. getAgreement(this.idCopy).then(response => {
  994. this.register()
  995. this.deptName = response.data.dept.deptName
  996. this.form = response.data.tWarehouseAgreement
  997. this.form.fId = null
  998. this.form.fBillstatus = ''
  999. this.$set(this.form, 'fTaskType', this.form.fTaskType + '')
  1000. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  1001. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  1002. this.operator = this.form.createBy
  1003. this.agreementitemsList = response.data.tWarehouseAgreementitems
  1004. for (let item in this.agreementitemsList) {
  1005. this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
  1006. }
  1007. this.fWbuOptions = response.data.feesList
  1008. this.open = true
  1009. this.title = '修改作业费'
  1010. })
  1011. }else{
  1012. this.stop = false
  1013. this.browseStatus = false
  1014. this.determine = false
  1015. this.reset()
  1016. this.cancelButton = true
  1017. const fId = row.fId || this.ids
  1018. getAgreement(fId).then(response => {
  1019. this.register()
  1020. this.deptName = response.data.dept.deptName
  1021. this.form = response.data.tWarehouseAgreement
  1022. this.$set(this.form, 'fTaskType', this.form.fTaskType + '')
  1023. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  1024. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  1025. this.operator = this.form.createBy
  1026. this.agreementitemsList = response.data.tWarehouseAgreementitems
  1027. for (let item in this.agreementitemsList) {
  1028. this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
  1029. }
  1030. this.fWbuOptions = response.data.feesList
  1031. this.open = true
  1032. this.title = '修改作业费'
  1033. })
  1034. }
  1035. },
  1036. /** 远程模糊查询用户 */
  1037. corpsRemoteMethod(name) {
  1038. if (name == null || name === "") {
  1039. return false;
  1040. }
  1041. let queryParams = { pageNum: 1, fName: name, type: 1 };
  1042. listCorps(queryParams).then((response) => {
  1043. this.fMblnoOptions = response.rows;
  1044. this.KHblnoOptions = response.rows;
  1045. });
  1046. },
  1047. /** 提交按钮 */
  1048. submitForm() {
  1049. if(this.addOrEdid == 2){
  1050. this.$set(this.form, 'fId', null)
  1051. }
  1052. this.$refs['form'].validate(valid => {
  1053. if (valid) {
  1054. let formData = new window.FormData()
  1055. formData.append('agreement', JSON.stringify(this.form))
  1056. formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
  1057. addAgreement(formData).then(response => {
  1058. this.msgSuccess('操作成功')
  1059. this.form = response.data.tWarehouseAgreement
  1060. this.$set(this.form, 'fTaskType', this.form.fTaskType + '')
  1061. this.$set(this.form, 'fEnddate', Date.parse(this.form.fEnddate))
  1062. this.$set(this.form, 'fBegindate', Date.parse(this.form.fBegindate))
  1063. })
  1064. }
  1065. })
  1066. },
  1067. /** 删除按钮操作 */
  1068. handleDelete(row) {
  1069. const fIds = row.fId || this.ids;
  1070. this.$confirm('是否确认删除作业费编号为"' + fIds + '"的数据项?', "警告", {
  1071. confirmButtonText: "确定",
  1072. cancelButtonText: "取消",
  1073. type: "warning"
  1074. }).then(function() {
  1075. return delAgreement(fIds);
  1076. }).then(() => {
  1077. this.getList();
  1078. this.msgSuccess("删除成功");
  1079. })
  1080. },
  1081. /** 导出按钮操作 */
  1082. handleExport() {
  1083. const queryParams = this.queryParams
  1084. this.$confirm('是否确认导出所有作业费数据项?', '警告', {
  1085. confirmButtonText: '确定',
  1086. cancelButtonText: '取消',
  1087. type: 'warning'
  1088. }).then(function() {
  1089. return exportAgreement(queryParams)
  1090. }).then(response => {
  1091. this.download(response.msg)
  1092. })
  1093. },
  1094. deleteRow(index, rows) {
  1095. rows.splice(index, 1);
  1096. },
  1097. }
  1098. }
  1099. </script>