taskAllocationMaterial.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. <!-- 任务分配(原料)页面 -->
  2. <template>
  3. <div class="examination">
  4. <div class="common-head-search">
  5. <el-form :inline="true">
  6. <el-form-item label="检验车间">
  7. <el-select v-model="search.deptNo" filterable clearable style="width: 100%" collapse-tags @clear="clearSelect"
  8. @change="selectClass" size="small">
  9. <el-option v-for="item in sectionNameType" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="检验班组">
  14. <el-select v-model="search.sectionNo" filterable clearable style="width: 100%" collapse-tags
  15. @change="selectSection" size="small">
  16. <el-option v-for="item in sectionClassType" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="岗位">
  21. <el-select v-model="search.jobs" clearable style="width: 100%" filterable collapse-tags size="small">
  22. <el-option v-for="(item, index) in postType" :key="index" :label="item.postName" :value="item.postNo">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <!-- <el-form-item label="物料名称">-->
  27. <!-- <el-input v-model="search.matName" @keyup.enter.native="searchData()" size="small" placeholder="请输入物料名称" style="width: 200px"></el-input>-->
  28. <!-- </el-form-item>-->
  29. <el-form-item label="任务日期">
  30. <el-date-picker v-model="search.entrTime[0]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
  31. placeholder="开始日期" size="mini" style="width: 140px">
  32. </el-date-picker>
  33. <span>至</span>
  34. <el-date-picker v-model="search.entrTime[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
  35. placeholder="结束日期" size="mini" style="width: 140px">
  36. </el-date-picker>
  37. <!-- <el-date-picker
  38. v-model="search.entrTime"
  39. type="daterange"
  40. range-separator="至"
  41. start-placeholder="开始日期"
  42. end-placeholder="结束日期"
  43. size="small"
  44. style="width: 300px"
  45. format="yyyy-MM-dd"
  46. value-format="yyyy-MM-dd"
  47. >
  48. </el-date-picker> -->
  49. </el-form-item>
  50. <el-form-item>
  51. <el-button icon="el-icon-search" type="goon" size="mini" :disable="disSearch"
  52. @click="searchData">查询</el-button>
  53. <el-button icon="el-icon-refresh" type="info" plain size="mini" :disable="disSearch"
  54. @click="reset">重置</el-button>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. <div>
  59. <el-row>
  60. <el-col :span="4">
  61. <div class="common-title-name">
  62. <img style="width: 25px; height: 25px" src="../../../../assets/img/imgScreen/logo.png" />
  63. 物料名称
  64. </div>
  65. <div class="common-table-div">
  66. <el-table ref="tableMain11" :height="theight1" v-loading="tableLoading11" :data="tableData11"
  67. highlight-current-row @row-click="handleCurrentChange" :header-cell-style="tableHeaderCellStyle"
  68. :summary-method="getSummaries11" show-summary border style="width: 100%" :icorePanelShown="100"
  69. :icore-filter-flag="icoreFilterFlag">
  70. <el-table-column sortable show-overflow-tooltip align="center" min-width="100" prop="MAT_NAME"
  71. label="物料名称"></el-table-column>
  72. </el-table>
  73. </div>
  74. </el-col>
  75. <el-col :span="20">
  76. <el-tabs type="border-card" v-model="activeName">
  77. <el-tab-pane label="任务未分配" name="first">
  78. <span slot="label">任务未分配<el-badge :max="10" :hidden="total == 0" style="margin-top: -18px"
  79. :value="total"></el-badge></span>
  80. <div class="common-title-div">
  81. <div class="common-title-name">
  82. <img style="width: 25px; height: 25px" src="../../../../assets/img/imgScreen/logo.png" />
  83. 任务未分配
  84. </div>
  85. <div>
  86. <el-button icon="el-icon-check" type="goon" size="mini" v-privilege="activeMenu + 'distribution'"
  87. @click="checkAllot">分配</el-button>
  88. <el-button icon="el-icon-check" type="goon" size="mini" :loading="recipientsLoading"
  89. v-privilege="activeMenu + 'recipients'" @click="recipients">领用</el-button>
  90. <!-- <el-button icon="el-icon-circle-close" :loading="buttonLoading1" type="danger" size="mini" v-privilege="activeMenu + 'disable'" @click="deleteData">停用</el-button>-->
  91. <!-- <el-button icon="el-icon-check" :loading="buttonLoading2" type="goon" size="mini" v-privilege="activeMenu + 'effectivity'" @click="recoverData">启用</el-button>-->
  92. </div>
  93. </div>
  94. <div class="common-table-div">
  95. <el-table v-loading="tableLoading1" ref="dataTable" border :height="tableTop" highlight-current-row
  96. @selection-change="handleSelectionChange" :data="tableData1" :row-class-name="tableRowClassName"
  97. :icore-filter-flag="icoreFilterFlag" :header-cell-style="tableHeaderCellStyle"
  98. :summary-method="getSummaries2" show-summary>
  99. <el-table-column type="index" label="NO" align="center"></el-table-column>
  100. <el-table-column type="selection" width="55" align="center"></el-table-column>
  101. <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="stateFlagName" label="是否分配" align="center" ></el-table-column> -->
  102. <el-table-column :show-overflow-tooltip="true" sortable min-width="150px" prop="typeName" label="中心编号"
  103. align="center"></el-table-column>
  104. <el-table-column sortable :show-overflow-tooltip="true" min-width="150px" prop="carNo" label="委托编号"
  105. align="center"></el-table-column>
  106. <!-- <el-table-column :show-overflow-tooltip="true" sortable min-width="100px" prop="tkId" label="任务编号" align="center"></el-table-column> -->
  107. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="matName" label="物料名称"
  108. align="center"></el-table-column>
  109. <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop='matOrder' label="物料顺序"></el-table-column> -->
  110. <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="testItemName"
  111. label="任务名称"></el-table-column>
  112. <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="itemTypeName"
  113. label="任务类型" align="center"></el-table-column>
  114. <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="validFlagName"
  115. label="数据状态" align="center"></el-table-column>
  116. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="memo" label="备注"
  117. align="center"></el-table-column>
  118. <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stdName" label="标准号" align="center"></el-table-column> -->
  119. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="testLimit"
  120. label="任务时限" align="center"></el-table-column>
  121. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="taskDate" label="任务日期"
  122. align="center"></el-table-column>
  123. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="receivedDate"
  124. label="收样日期" align="center"></el-table-column>
  125. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="testPostName"
  126. label="岗位名称" align="center"></el-table-column>
  127. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="eqpTypeName"
  128. label="设备" align="center"></el-table-column>
  129. <el-table-column sortable :show-overflow-tooltip="true" min-width="95px" prop="createMan" label="创建人"
  130. align="center"></el-table-column>
  131. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="createTime"
  132. label="创建时间" align="center"></el-table-column>
  133. <el-table-column sortable :show-overflow-tooltip="true" min-width="95px" prop="updateMan" label="修改人"
  134. align="center"></el-table-column>
  135. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="updateTime"
  136. label="修改时间" align="center"></el-table-column>
  137. </el-table>
  138. </div>
  139. <!-- 分页一 -->
  140. <div class="common-foot-style">
  141. <el-pagination @size-change="pageSizeChange" @current-change="pageCurrentChange"
  142. :current-page="pageIndex" :page-sizes="[100, 200, 500, 800, 1000]" :page-size="pageSize"
  143. layout="total, sizes, prev, pager, next, jumper" :total="total" background>
  144. </el-pagination>
  145. </div>
  146. </el-tab-pane>
  147. <el-tab-pane label="任务已分配" name="second">
  148. <span slot="label">任务已分配<el-badge :max="10" :hidden="totalDep == 0" style="margin-top: -18px"
  149. :value="totalDep"></el-badge></span>
  150. <div class="common-title-div">
  151. <div class="common-title-name">
  152. <img style="width: 25px; height: 25px" src="../../../../assets/img/imgScreen/logo.png" />
  153. 任务已分配
  154. </div>
  155. <div>
  156. <el-button icon="el-icon-circle-close" type="danger" :loading="buttonLoading3" size="mini"
  157. v-privilege="activeMenu + 'Unassign'" @click="cancel">取消分配</el-button>
  158. </div>
  159. </div>
  160. <div class="common-table-div">
  161. <el-table v-loading="tableLoading2" ref="dataTable2" border :height="tableBot" highlight-current-row
  162. @selection-change="handleSelectionChange2" :data="tableData2" :row-class-name="tableRowClassName2"
  163. :icore-filter-flag="icoreFilterFlag" :header-cell-style="tableHeaderCellStyle"
  164. :summary-method="getSummaries2" show-summary>
  165. <el-table-column type="index" label="NO" align="center"></el-table-column>
  166. <el-table-column type="selection" width="55" align="center"></el-table-column>
  167. <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="stateFlagName" label="是否分配" align="center" ></el-table-column> -->
  168. <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="carNo" label="委托编号"
  169. align="center"></el-table-column>
  170. <el-table-column :show-overflow-tooltip="true" sortable min-width="100px" prop="typeName" label="中心编号"
  171. align="center"></el-table-column>
  172. <!-- <el-table-column :show-overflow-tooltip="true" sortable min-width="100px" prop="id" label="任务编号" align="center"></el-table-column> -->
  173. <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="taskDate" label="任务日期"
  174. align="center"></el-table-column>
  175. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="receivedDate"
  176. label="收样日期" align="center"></el-table-column>
  177. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="matName" label="物料名称"
  178. align="center"></el-table-column>
  179. <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop='matOrder' label="物料顺序"></el-table-column> -->
  180. <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="testItemName"
  181. label="任务名称" align="center"></el-table-column>
  182. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="itemTypeName"
  183. label="任务类型" align="center"></el-table-column>
  184. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="optName" label="执行人"
  185. align="center"></el-table-column>
  186. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stdName" label="标准号"
  187. align="center"></el-table-column>
  188. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="pointName" label="地点"
  189. align="center"></el-table-column>
  190. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="testLimit"
  191. label="任务时限" align="center"></el-table-column>
  192. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="testPostName"
  193. label="岗位" align="center"></el-table-column>
  194. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="eqpTypeName"
  195. label="设备" align="center"></el-table-column>
  196. <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="deptName" label="部门名称"
  197. align="center"></el-table-column>
  198. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="sectionName"
  199. label="班组名称" align="center"></el-table-column>
  200. <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="validFlagName"
  201. label="数据状态" align="center"></el-table-column>
  202. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="memo" label="备注"
  203. align="center"></el-table-column>
  204. <el-table-column sortable :show-overflow-tooltip="true" min-width="95px" prop="createMan" label="创建人"
  205. align="center"></el-table-column>
  206. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="createTime"
  207. label="创建时间" align="center"></el-table-column>
  208. <el-table-column sortable :show-overflow-tooltip="true" min-width="95px" prop="updateMan" label="修改人"
  209. align="center"></el-table-column>
  210. <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="updateTime"
  211. label="修改时间" align="center"></el-table-column>
  212. </el-table>
  213. </div>
  214. <div class="common-foot-style">
  215. <el-pagination @size-change="pageSizeChange2" @current-change="pageCurrentChange2"
  216. :current-page="pageIndex_dep" :page-sizes="[100, 200, 500, 800, 1000]" :page-size="pageSize_dep"
  217. layout="total, sizes, prev, pager, next, jumper" :total="totalDep" background>
  218. </el-pagination>
  219. </div>
  220. </el-tab-pane>
  221. </el-tabs>
  222. </el-col>
  223. </el-row>
  224. </div>
  225. <el-dialog @close="closeDialog" :visible.sync="dialogTableVisible" width="70%">
  226. <div slot="title">
  227. <i class="el-icon-document" style="font-size: 20px"></i>
  228. <span style="margin-left: 10px; font-size: 18px">选择人员</span>
  229. </div>
  230. <el-form :inline="true" @submit.native.prevent>
  231. <el-form-item label="人员编号">
  232. <el-input v-model="form.empNo" size="small" @keyup.enter.native="searchAllot()" placeholder="请输入搜索条件"
  233. style="width: 200px"></el-input>
  234. </el-form-item>
  235. <el-form-item label="人员名称">
  236. <el-input v-model="form.empName" size="small" @keyup.enter.native="searchAllot()" placeholder="请输入搜索条件"
  237. style="width: 200px"></el-input>
  238. </el-form-item>
  239. <el-form-item>
  240. <el-button icon="el-icon-search" type="goon" @click="searchAllot" size="mini">查询</el-button>
  241. </el-form-item>
  242. </el-form>
  243. <el-table v-loading="allotLoading" ref="dataTable" border height="300" highlight-current-row
  244. @row-click="handleAllot" :data="allotData" :icore-filter-flag="icoreFilterFlag"
  245. :header-cell-style="tableHeaderCellStyle" :summary-method="getSummaries2" show-summary>
  246. <el-table-column type="index" label="NO" align="center"></el-table-column>
  247. <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="empNo" label="人员编号"
  248. align="center"></el-table-column>
  249. <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="empName" label="人员姓名"
  250. align="center"></el-table-column>
  251. <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="deptName" label="部门"
  252. align="center"></el-table-column>
  253. <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="wrkGrpName" label="班组"
  254. align="center"></el-table-column>
  255. </el-table>
  256. <div>
  257. <el-pagination @size-change="pageSizeAllot" @current-change="pageCurrentAllot" :current-page="allotIndex"
  258. :page-sizes="[100, 200, 500]" :page-size="allotPage" layout="total, sizes, prev, pager, next, jumper"
  259. :total="allotTotal" background>
  260. </el-pagination>
  261. </div>
  262. <div slot="footer" class="dialog-footer">
  263. <el-button type="goon" size="mini" icon="el-icon-check" @click="allocation()">确定</el-button>
  264. <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancelData">取消</el-button>
  265. </div>
  266. </el-dialog>
  267. </div>
  268. </template>
  269. <script>
  270. import { getCookie, formatDate, isStartEndDate } from "@/utils/util.js";
  271. import { cookieUserId, cookieUserName } from "@/config/config.js";
  272. let userName = getCookie(cookieUserName);
  273. let userId = getCookie(cookieUserId);
  274. export default {
  275. data() {
  276. return {
  277. icoreFilterFlag: true,
  278. dialogTableVisible: false,
  279. activeName: "first",
  280. taskId: "",
  281. theight1: 0,
  282. tableLoading11: false,
  283. tableData11: [],
  284. testItemNo: "",
  285. form: {
  286. empNo: "",
  287. empName: "",
  288. },
  289. jobType: [],
  290. allotIndex: 1,
  291. allotPage: 500,
  292. allotTotal: 0,
  293. classNo: "",
  294. deptNo: "",
  295. sectionNo: "",
  296. allotLoading: false,
  297. search: {
  298. mode: "",
  299. deptNo: "",
  300. sectionNo: "",
  301. entrTime: [],
  302. itemTypeName: "",
  303. jobs: "",
  304. },
  305. matMatName: "", //物料表点击的物料
  306. sectionNameType: [],
  307. sectionClassType: [],
  308. postType: [],
  309. companyNameType: [],
  310. disSearch: false,
  311. allotData: [],
  312. clickAllot: {},
  313. tableData1: [],
  314. tableData2: [],
  315. tableData3: [],
  316. tableLoading1: false,
  317. tableLoading2: false,
  318. tableLoading3: false,
  319. recipientsLoading: false,
  320. buttonLoading1: false,
  321. buttonLoading2: false,
  322. buttonLoading3: false,
  323. buttonLoading4: false,
  324. itemType: [],
  325. selectMain: [],
  326. selectDep: [],
  327. tableTop: 0,
  328. tableBot: 0,
  329. pageIndex: 1,
  330. pageSize: 500,
  331. total: 0,
  332. pageIndex_dep: 1,
  333. pageSize_dep: 500,
  334. totalDep: 0,
  335. activeMenu: "",
  336. };
  337. },
  338. created() {
  339. this.theight1 = window.innerHeight - 165;
  340. this.tableTop = window.innerHeight - 230;
  341. this.tableBot = window.innerHeight - 230;
  342. this.search.entrTime = [this.getYNM(new Date()), this.getYNM(new Date())];
  343. this.activeMenu = window.top.localStorage.getItem("activeMenu");
  344. this.axios
  345. .post(
  346. "pass/baseManagement/v1/limsbaseposts/queryLimsBasePostList",
  347. {},
  348. { individualType: "json" }
  349. )
  350. .then((res) => {
  351. this.jobType = res.data;
  352. });
  353. this.axios
  354. .post(
  355. "pass/baseManagement/v1/sysorgs/querySysOrgCompanyAll",
  356. {},
  357. { individualType: "json" }
  358. )
  359. .then((response) => {
  360. this.companyNameType = response.data;
  361. // this.getCompany()
  362. this.selectDepartment("JCZX");
  363. });
  364. },
  365. mounted() {
  366. this.searchAllot();
  367. this.addScreen();
  368. this.addScreen2();
  369. },
  370. methods: {
  371. getYNM(date) {
  372. let year = date.getFullYear().toString();
  373. let month = date.getMonth() + 1;
  374. let day = date.getDate();
  375. month = month < 10 ? "0" + month : month;
  376. day = day < 10 ? "0" + day : day;
  377. return `${year}-${month}-${day}`;
  378. },
  379. getSummaries2(param) {
  380. const { columns, data } = param;
  381. const sums = [];
  382. columns.forEach((column, index) => {
  383. if (index === 0) {
  384. sums[index] = "总计";
  385. }
  386. if (index === 1) {
  387. sums[index] = data.length;
  388. } else if (column.property === "quantity") {
  389. let val = 0;
  390. for (let i in data) {
  391. val = this.floatComputed(
  392. data[i].quantity ? data[i].quantity : 0,
  393. val,
  394. "+"
  395. );
  396. }
  397. sums[index] = val;
  398. } else if (column.property === "factweight") {
  399. let val = 0;
  400. for (let i in data) {
  401. val = this.floatComputed(
  402. data[i].factweight ? data[i].factweight : 0,
  403. val,
  404. "+"
  405. );
  406. }
  407. sums[index] = val;
  408. }
  409. });
  410. return sums;
  411. },
  412. selectDepartment(val) {
  413. this.sectionNameType = [];
  414. this.companyNameType.find((item) => {
  415. if (val === item.orgCode) {
  416. this.sectionNameType = item.sysOrgList;
  417. }
  418. });
  419. },
  420. clearSelect() {
  421. this.search.sectionNo = "";
  422. this.search.jobs = "";
  423. this.postType = "";
  424. },
  425. //根据选中的部门名称,查询班组名称
  426. selectClass(val) {
  427. this.sectionClassType = [];
  428. this.sectionNameType.find((item) => {
  429. if (val === item.orgCode) {
  430. this.sectionClassType = item.sysOrgList;
  431. this.search.sectionNo = "";
  432. }
  433. });
  434. },
  435. //根据选中的部门名称,查询班组名称
  436. selectClass2(val) {
  437. this.sectionClassType = [];
  438. this.sectionNameType.find((item) => {
  439. if (val === item.orgCode) {
  440. this.sectionClassType = item.sysOrgList;
  441. }
  442. });
  443. },
  444. selectPost(val) {
  445. this.postType = [];
  446. this.jobType.forEach((item) => {
  447. if (val === item.sectionNo) {
  448. this.postType.push(item);
  449. }
  450. });
  451. },
  452. selectSection(val) {
  453. this.search.jobs = "";
  454. this.selectPost(val);
  455. },
  456. closeDialog() {
  457. this.clickAllot = {};
  458. this.form = {
  459. empNo: "",
  460. empName: "",
  461. };
  462. this.searchAllot();
  463. },
  464. cancelData() {
  465. this.clickAllot = {};
  466. (this.form = {
  467. empNo: "",
  468. empName: "",
  469. }),
  470. this.searchAllot();
  471. this.dialogTableVisible = false;
  472. },
  473. searchAllot() {
  474. this.allotIndex = 1;
  475. this.allotPage = 500;
  476. this.dataAllot();
  477. },
  478. dataAllot() {
  479. this.clickAllot = {};
  480. this.allotLoading = true;
  481. let obj = {
  482. object: {
  483. empNo: this.form.empNo,
  484. empName: this.form.empName,
  485. validFlag: 1,
  486. },
  487. pageIndex: this.allotIndex,
  488. pageSize: this.allotPage,
  489. };
  490. this.axios
  491. .post("pass/baseManagement/v1/limslrcemps/queryEmpPagesDS", obj, {
  492. individualType: "json",
  493. })
  494. .then((res) => {
  495. if (res.code == 0 || res.code == 200) {
  496. this.allotData = res.data.list;
  497. this.allotTotal = res.data.total;
  498. } else {
  499. this.$message.error(res.message);
  500. }
  501. this.allotLoading = false;
  502. })
  503. .catch((err) => {
  504. this.allotLoading = false;
  505. this.$message.error(err.message);
  506. });
  507. },
  508. checkAllot() {
  509. if (this.selectMain.length < 1) {
  510. this.$message.warning("请勾选您要分配的数据");
  511. return;
  512. }
  513. for (let item of this.selectMain) {
  514. if (item.validFlag == 0) {
  515. this.$message.warning("已停用的数据不可进行分配");
  516. return;
  517. }
  518. }
  519. this.dialogTableVisible = true;
  520. },
  521. //获取个人所属哪个公司
  522. getCompany() {
  523. this.axios
  524. .get("pass/baseManagement/v1/limslrcemps/" + userId)
  525. .then((res) => {
  526. if (res.code == 0 || res.code == 200) {
  527. this.search.deptNo = res.data ? res.data.deptNo : "";
  528. this.search.sectionNo = res.data ? res.data.sectionNo : "";
  529. this.search.jobs = res.data ? res.data.postNo : "";
  530. // this.classNo = res.data ? res.data.postNo : ''
  531. // this.deptNo = res.data ? res.data.deptNo : ''
  532. // this.sectionNo = res.data ? res.data.sectionNo : ''
  533. this.selectClass2(this.search.deptNo);
  534. this.selectPost(this.search.sectionNo);
  535. this.searchData();
  536. } else {
  537. this.disSearch = true;
  538. this.$message.error(e.message);
  539. }
  540. })
  541. .catch((e) => {
  542. this.disSearch = true;
  543. this.$message.error(e.message);
  544. });
  545. },
  546. ///分配
  547. allocation() {
  548. if (JSON.stringify(this.clickAllot) === "{}") {
  549. this.$message.warning("请先点击选中一条数据");
  550. return;
  551. }
  552. let newList = [];
  553. newList = JSON.parse(JSON.stringify(this.selectMain));
  554. newList.forEach((item) => {
  555. (item.optNo = this.clickAllot.empNo),
  556. (item.optName = this.clickAllot.empName),
  557. (item.deptNo = this.clickAllot.deptNo),
  558. (item.deptName = this.clickAllot.deptName),
  559. (item.sectionNo = this.clickAllot.sectionNo),
  560. (item.sectionName = this.clickAllot.sectionName);
  561. });
  562. this.axios
  563. .post("pass/testManagement/v1/limstasktests/assign", newList, {
  564. individualType: "json",
  565. })
  566. .then((res) => {
  567. if (res.code == 0 || res.code == 200) {
  568. this.$message.success(res.message);
  569. this.dialogTableVisible = false;
  570. this.searchData();
  571. } else {
  572. this.$message.error(res.message);
  573. }
  574. })
  575. .catch((err) => {
  576. this.$message.error(err.message);
  577. });
  578. },
  579. //领用
  580. recipients() {
  581. if (this.selectMain.length < 1) {
  582. this.$message.warning("请勾选您要领用的数据");
  583. return;
  584. }
  585. for (let item of this.selectMain) {
  586. if (item.validFlag == 0) {
  587. this.$message.warning("已停用的数据不可进行领用");
  588. return;
  589. }
  590. }
  591. let newList = [];
  592. newList = JSON.parse(JSON.stringify(this.selectMain));
  593. this.recipientsLoading = true;
  594. this.axios
  595. .post("pass/testManagement/v1/limstasktests/assign", newList, {
  596. individualType: "json",
  597. })
  598. .then((res) => {
  599. if (res.code == 0 || res.code == 200) {
  600. this.$message.success(res.message);
  601. this.dataMain(this.matMatName);
  602. this.dataDep(this.matMatName);
  603. // this.searchData()
  604. } else {
  605. this.$message.error(res.message);
  606. }
  607. this.recipientsLoading = false;
  608. })
  609. .catch((err) => {
  610. this.recipientsLoading = false;
  611. this.$message.error(err.message);
  612. });
  613. },
  614. // 终止
  615. deleteData() {
  616. if (this.selectMain.length < 1) {
  617. this.$message.warning("请勾选您要停用的数据");
  618. return;
  619. }
  620. this.buttonLoading1 = true;
  621. this.axios
  622. .post("pass/testManagement/v1/limstasktests/abolish", this.selectMain, {
  623. individualType: "json",
  624. })
  625. .then((res) => {
  626. if (res.code == 0 || res.code == 200) {
  627. this.$message.success(res.message);
  628. this.searchData();
  629. } else {
  630. this.$message.error(res.message);
  631. }
  632. this.buttonLoading1 = false;
  633. })
  634. .catch((err) => {
  635. this.buttonLoading1 = false;
  636. this.$message.error(err.message);
  637. });
  638. },
  639. // 恢复
  640. recoverData() {
  641. if (this.selectMain.length < 1) {
  642. this.$message.warning("请勾选您要启用的数据");
  643. return;
  644. }
  645. this.buttonLoading2 = true;
  646. this.axios
  647. .post("pass/testManagement/v1/limstasktests/recover", this.selectMain, {
  648. individualType: "json",
  649. })
  650. .then((res) => {
  651. if (res.code == 0 || res.code == 200) {
  652. this.$message.success(res.message);
  653. this.searchData();
  654. } else {
  655. this.$message.error(res.message);
  656. }
  657. this.buttonLoading2 = false;
  658. })
  659. .catch((err) => {
  660. this.buttonLoading2 = false;
  661. this.$message.error(err.message);
  662. });
  663. },
  664. // TODO 查询物料
  665. searchData() {
  666. this.queryTaskMaterials();
  667. },
  668. queryTaskMaterials() {
  669. this.tableLoading11 = true;
  670. let startTime = "";
  671. let endTime = "";
  672. if (!this.search.entrTime) {
  673. startTime = "";
  674. endTime = "";
  675. } else {
  676. startTime = this.search.entrTime[0] + " 00:00:00";
  677. endTime = this.search.entrTime[1] + " 23:59:59";
  678. }
  679. let params = {
  680. startTime: startTime,
  681. endTime: endTime,
  682. stateFlags: [0],
  683. sampleTypeCode: "480101",
  684. deptNo: this.search.deptNo,
  685. sectionNo: this.search.sectionNo,
  686. jobs: this.search.jobs,
  687. matName: this.search.matName,
  688. optNo: userId,
  689. };
  690. this.axios
  691. .post(
  692. "pass/testManagement/v1/limstasktests/queryTaskMaterials",
  693. params,
  694. { individualType: "json" }
  695. )
  696. .then((res) => {
  697. if (res.code == 0 || res.code == 200) {
  698. this.tableData11 = res.data;
  699. } else {
  700. this.$message.error(res.message);
  701. }
  702. this.tableLoading11 = false;
  703. })
  704. .catch((e) => {
  705. this.tableLoading11 = false;
  706. this.$message.error(e.message);
  707. });
  708. },
  709. dataMain(matName) {
  710. this.tableLoading1 = true;
  711. let startTime = "";
  712. let endTime = "";
  713. if (!this.search.entrTime) {
  714. startTime = "";
  715. endTime = "";
  716. } else {
  717. startTime = this.search.entrTime[0] + " 00:00:00";
  718. endTime = this.search.entrTime[1] + " 23:59:59";
  719. }
  720. let tempobj = {
  721. object: {
  722. itemTypeName: this.search.itemTypeName,
  723. stateFlag: 0,
  724. sampleTypeCode: 480101,
  725. },
  726. mode3: matName,
  727. mode4: this.search.deptNo ? this.search.deptNo : this.deptNo,
  728. list: this.search.sectionNo
  729. ? [this.search.sectionNo]
  730. : this.sectionNo
  731. ? [this.sectionNo]
  732. : [],
  733. mode: this.search.jobs ? this.search.jobs : this.classNo,
  734. pageIndex: this.pageIndex,
  735. pageSize: this.pageSize,
  736. startTime: startTime,
  737. endTime: endTime,
  738. };
  739. this.axios
  740. .post(
  741. "pass/testManagement/v1/limstasktests/queryLimsTaskTestPage",
  742. tempobj,
  743. { individualType: "json" }
  744. )
  745. .then((res) => {
  746. if (res.code == 0 || res.code == 200) {
  747. this.tableData1 = res.data.list;
  748. this.total = res.data.total;
  749. this.tableData1.forEach((item) => {
  750. item.typeName =
  751. item.itemTypeCode == "480402" ? item.markNo : item.sampleNo;
  752. item.validFlagName =
  753. item.validFlag == 0
  754. ? "无效"
  755. : item.validFlag == 1
  756. ? "有效"
  757. : "";
  758. item.stateFlagName =
  759. item.stateFlag == 0
  760. ? "未分配"
  761. : item.stateFlag == 1
  762. ? "已分配"
  763. : "";
  764. item.isAutoName =
  765. item.isAuto == 0 ? "手动" : item.isAuto == 1 ? "自动" : "";
  766. });
  767. } else {
  768. this.$message.error(res.message);
  769. }
  770. this.tableLoading1 = false;
  771. })
  772. .catch((e) => {
  773. this.tableLoading1 = false;
  774. this.$message.error(e.message);
  775. });
  776. },
  777. dataDep(matName) {
  778. this.tableLoading2 = true;
  779. let startTime = "";
  780. let endTime = "";
  781. if (!this.search.entrTime) {
  782. startTime = "";
  783. endTime = "";
  784. } else {
  785. startTime = this.search.entrTime[0] + " 00:00:00";
  786. endTime = this.search.entrTime[1] + " 23:59:59";
  787. }
  788. let tempobj = {
  789. object: {
  790. itemTypeName: this.search.itemTypeName,
  791. stateFlag: 1,
  792. sampleTypeCode: 480101,
  793. optNo: userId,
  794. },
  795. mode3: matName,
  796. mode4: this.search.deptNo ? this.search.deptNo : this.deptNo,
  797. list: this.search.sectionNo
  798. ? [this.search.sectionNo]
  799. : this.sectionNo
  800. ? [this.sectionNo]
  801. : [],
  802. mode: this.search.jobs ? this.search.jobs : this.classNo,
  803. pageIndex: this.pageIndex_dep,
  804. pageSize: this.pageSize_dep,
  805. startTime: startTime,
  806. endTime: endTime,
  807. };
  808. this.axios
  809. .post(
  810. "pass/testManagement/v1/limstasktests/queryLimsTaskTestPage",
  811. tempobj,
  812. { individualType: "json" }
  813. )
  814. .then((res) => {
  815. if (res.code == 0 || res.code == 200) {
  816. this.tableData2 = res.data.list;
  817. this.totalDep = res.data.total;
  818. this.tableData2.forEach((item) => {
  819. item.typeName =
  820. item.itemTypeCode == "480402" ? item.markNo : item.sampleNo;
  821. item.validFlagName =
  822. item.validFlag == 0
  823. ? "无效"
  824. : item.validFlag == 1
  825. ? "有效"
  826. : "";
  827. item.stateFlagName =
  828. item.stateFlag == 0
  829. ? "未分配"
  830. : item.stateFlag == 1
  831. ? "已分配"
  832. : "";
  833. item.isAutoName =
  834. item.isAuto == 0 ? "手动" : item.isAuto == 1 ? "自动" : "";
  835. });
  836. } else {
  837. this.$message.error(res.message);
  838. }
  839. this.tableLoading2 = false;
  840. })
  841. .catch((e) => {
  842. this.tableLoading2 = false;
  843. this.$message.error(e.message);
  844. });
  845. },
  846. // 重置
  847. reset() {
  848. this.search.matName = "";
  849. this.search.jobs = "";
  850. this.search.deptNo = "";
  851. this.search.sectionNo = "";
  852. this.search.entrTime = [this.getYNM(new Date()), this.getYNM(new Date())];
  853. this.searchData();
  854. },
  855. // 取消分配
  856. cancel() {
  857. if (this.selectDep.length < 1) {
  858. this.$message.warning("请勾选需要取消分配的数据");
  859. return;
  860. }
  861. this.buttonLoading3 = true;
  862. this.axios
  863. .post("pass/testManagement/v1/limstasktests/unassign", this.selectDep, {
  864. individualType: "json",
  865. })
  866. .then((res) => {
  867. if (res.code == 0 || res.code == 200) {
  868. this.$message.success(res.message);
  869. this.dataMain(this.matMatName);
  870. this.dataDep(this.matMatName);
  871. // this.searchData()
  872. } else {
  873. this.$message.error(res.message);
  874. }
  875. this.buttonLoading3 = false;
  876. })
  877. .catch((err) => {
  878. this.buttonLoading3 = false;
  879. this.$message.error(err.message);
  880. });
  881. },
  882. pageSizeAllot(size) {
  883. this.allotIndex = 1;
  884. this.allotPage = size;
  885. this.dataAllot();
  886. },
  887. pageCurrentAllot(index) {
  888. this.allotIndex = index;
  889. this.dataAllot();
  890. },
  891. pageSizeChange(size) {
  892. this.pageIndex = 1;
  893. this.pageSize = size;
  894. this.dataMain(this.matMatName);
  895. },
  896. pageCurrentChange(index) {
  897. this.pageIndex = index;
  898. this.dataMain(this.matMatName);
  899. },
  900. pageSizeChange2(size) {
  901. this.pageIndex_dep = 1;
  902. this.pageSize_dep = size;
  903. this.dataDep(this.matMatName);
  904. },
  905. pageCurrentChange2(index) {
  906. this.pageIndex_dep = index;
  907. this.dataDep(this.matMatName);
  908. },
  909. // TODO 点击物料名称
  910. handleCurrentChange(val) {
  911. this.matMatName = val.MAT_NAME;
  912. this.selectMain = [];
  913. this.pageIndex = 1;
  914. this.pageSize = 500;
  915. this.dataMain(val.MAT_NAME);
  916. this.dataDep(val.MAT_NAME);
  917. },
  918. getSummaries11(param) {
  919. const { columns, data } = param;
  920. const sums = [];
  921. columns.forEach((column, index) => {
  922. if (index === 0) {
  923. sums[index] = "合计:" + data.length;
  924. }
  925. });
  926. return sums;
  927. },
  928. handleSelectionChange(val) {
  929. this.selectMain = val;
  930. },
  931. //勾选人员表格数据
  932. handleAllot(val) {
  933. this.clickAllot = Object.assign({}, val);
  934. },
  935. handleSelectionChange2(val) {
  936. this.selectDep = val;
  937. },
  938. addScreen() {
  939. this.$nextTick(() => {
  940. let ss = document.createElement("div");
  941. ss.innerHTML = "筛选";
  942. ss.style = "text-align: center;";
  943. if (
  944. this.$refs.dataTable.$el.getElementsByClassName("el-table__fixed")[0]
  945. ) {
  946. this.$refs.dataTable.$el
  947. .getElementsByClassName("el-table__fixed")[0]
  948. .getElementsByTagName("td")[0]
  949. .appendChild(ss);
  950. }
  951. });
  952. },
  953. addScreen2() {
  954. this.$nextTick(() => {
  955. let ss = document.createElement("div");
  956. ss.innerHTML = "筛选";
  957. ss.style = "text-align: center;";
  958. if (
  959. this.$refs.dataTable2.$el.getElementsByClassName("el-table__fixed")[0]
  960. ) {
  961. this.$refs.dataTable2.$el
  962. .getElementsByClassName("el-table__fixed")[0]
  963. .getElementsByTagName("td")[0]
  964. .appendChild(ss);
  965. }
  966. });
  967. },
  968. tableRowClassName({ row, column, rowIndex, columnIndex }) {
  969. if (row.validFlag !== "1") {
  970. return "error-row";
  971. }
  972. },
  973. tableRowClassName2({ row, column, rowIndex, columnIndex }) {
  974. if (row.validFlag !== "1") {
  975. return "error-row";
  976. }
  977. return "";
  978. },
  979. // 表格上横线
  980. tableHeaderCellStyle() {
  981. return "color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;";
  982. },
  983. },
  984. };
  985. </script>
  986. <style scoped></style>